Fixup a bunch of printf-style functions and debugs to use unsigned long when
[kai/samba.git] / source3 / utils / pdbedit.c
index aa11f2bfdf559df20f23e57c2c57df628bb515c3..0f1f6edf08626797f385c12799b23f75c3a19445 100644 (file)
@@ -157,22 +157,21 @@ static int print_sam_info (SAM_ACCOUNT *sam_pwent, BOOL verbosity, BOOL smbpwdst
                char lm_passwd[33];
                char nt_passwd[33];
 
-               uid = -1;
-               sid_to_uid(pdb_get_user_sid(sam_pwent), &uid);
+               uid = nametouid(pdb_get_username(sam_pwent));
                pdb_sethexpwd(lm_passwd, pdb_get_lanman_passwd(sam_pwent), pdb_get_acct_ctrl(sam_pwent));
                pdb_sethexpwd(nt_passwd, pdb_get_nt_passwd(sam_pwent), pdb_get_acct_ctrl(sam_pwent));
                        
-               printf("%s:%d:%s:%s:%s:LCT-%08X:\n",
+               printf("%s:%lu:%s:%s:%s:LCT-%08X:\n",
                       pdb_get_username(sam_pwent),
-                      uid,
+                      (unsigned long)uid,
                       lm_passwd,
                       nt_passwd,
                       pdb_encode_acct_ctrl(pdb_get_acct_ctrl(sam_pwent),NEW_PW_FORMAT_SPACE_PADDED_LEN),
                       (uint32)pdb_get_pass_last_set_time(sam_pwent));
        } else {
-               uid = -1;
-               sid_to_uid(pdb_get_user_sid(sam_pwent), &uid);
-               printf ("%s:%d:%s\n", pdb_get_username(sam_pwent), uid, pdb_get_fullname(sam_pwent));
+               uid = nametouid(pdb_get_username(sam_pwent));
+               printf ("%s:%lu:%s\n", pdb_get_username(sam_pwent), (unsigned long)uid, 
+                       pdb_get_fullname(sam_pwent));
        }
 
        return 0;       
@@ -337,7 +336,7 @@ static int new_user (struct pdb_context *in, const char *username,
        NTSTATUS nt_status;
        char *password1, *password2, *staticpass;
        
-       if (!NT_STATUS_IS_OK(nt_status = pdb_init_sam_new(&sam_pwent, username))) {
+       if (!NT_STATUS_IS_OK(nt_status = pdb_init_sam_new(&sam_pwent, username, 0))) {
                DEBUG(0, ("could not create account to add new user %s\n", username));
                return -1;
        }
@@ -606,13 +605,10 @@ int main (int argc, char **argv)
                exit(1);
        }
 
-       if (!init_names())
-               exit(1);
-
-       if (!idmap_init())
+       if(!initialize_password_db(False))
                exit(1);
 
-       if (!idmap_init_wellknown_sids())
+       if (!init_names())
                exit(1);
 
        setparms =      (backend ? BIT_BACKEND : 0) +