wbinfo: Handle SID_NAME_COMPUTER in sid_type_lookup
[ira/wip.git] / source / nsswitch / wbinfo.c
index 4538911f97ba37d4a9ee65ef3c1155158e9051ed..b2748833e6f700e282d5a742d42098377203d95f 100644 (file)
@@ -52,7 +52,7 @@ static char winbind_separator_int(bool strict)
                        return 0;
                }
                /* HACK: (this module should not call lp_ funtions) */
-               return *lp_winbind_separator(global_loadparm);
+               return *lp_winbind_separator(cmdline_lp_ctx);
        }
 
        sep = response.data.info.winbind_separator;
@@ -64,7 +64,7 @@ static char winbind_separator_int(bool strict)
                        return 0;
                }
                /* HACK: (this module should not call lp_ funtions) */
-               sep = *lp_winbind_separator(global_loadparm);
+               sep = *lp_winbind_separator(cmdline_lp_ctx);
        }
        
        return sep;
@@ -89,7 +89,7 @@ static const char *get_winbind_domain(void)
                d_fprintf(stderr, "could not obtain winbind domain name!\n");
                
                /* HACK: (this module should not call lp_ funtions) */
-               return lp_workgroup(global_loadparm);
+               return lp_workgroup(cmdline_lp_ctx);
        }
 
        fstrcpy(winbind_domain, response.data.domain_name);
@@ -653,6 +653,7 @@ static const char *sid_type_lookup(enum lsa_SidType r)
                case SID_NAME_DELETED: return "SID_NAME_DELETED"; break;
                case SID_NAME_INVALID: return "SID_NAME_INVALID"; break;
                case SID_NAME_UNKNOWN: return "SID_NAME_UNKNOWN"; break;
+               case SID_NAME_COMPUTER: return "SID_NAME_COMPUTER"; break;
        }
        return "Invalid sid type\n";
 }
@@ -786,7 +787,7 @@ static bool wbinfo_auth(char *username)
 
 /* Authenticate a user with a challenge/response */
 
-static bool wbinfo_auth_crap(char *username)
+static bool wbinfo_auth_crap(struct loadparm_context *lp_ctx, char *username)
 {
        struct winbindd_request request;
        struct winbindd_response response;
@@ -819,7 +820,7 @@ static bool wbinfo_auth_crap(char *username)
 
        generate_random_buffer(request.data.auth_crap.chal, 8);
         
-       if (lp_client_ntlmv2_auth(global_loadparm)) {
+       if (lp_client_ntlmv2_auth(lp_ctx)) {
                DATA_BLOB server_chal;
                DATA_BLOB names_blob;   
 
@@ -836,7 +837,7 @@ static bool wbinfo_auth_crap(char *username)
                server_chal = data_blob(request.data.auth_crap.chal, 8); 
                
                /* Pretend this is a login to 'us', for blob purposes */
-               names_blob = NTLMv2_generate_names_blob(mem_ctx, lp_netbios_name(global_loadparm), lp_workgroup(global_loadparm));
+               names_blob = NTLMv2_generate_names_blob(mem_ctx, lp_netbios_name(lp_ctx), lp_workgroup(lp_ctx));
                
                if (!SMBNTLMv2encrypt(mem_ctx, name_user, name_domain, pass, &server_chal, 
                                      &names_blob,
@@ -862,7 +863,7 @@ static bool wbinfo_auth_crap(char *username)
                data_blob_free(&lm_response);
 
        } else {
-               if (lp_client_lanman_auth(global_loadparm
+               if (lp_client_lanman_auth(lp_ctx
                    && SMBencrypt(pass, request.data.auth_crap.chal, 
                               (unsigned char *)request.data.auth_crap.lm_resp)) {
                        request.data.auth_crap.lm_resp_len = 24;
@@ -1218,7 +1219,7 @@ int main(int argc, char **argv, char **envp)
                                        got_error = true;
                                }
 
-                               if (!wbinfo_auth_crap(string_arg)) {
+                               if (!wbinfo_auth_crap(cmdline_lp_ctx, string_arg)) {
                                        d_fprintf(stderr, "Could not authenticate user %s with "
                                                "challenge/response\n", string_arg);
                                        got_error = true;