trying to get HEAD building again. If you want the code
[abartlet/samba.git/.git] / source3 / utils / pdbedit.c
index d540bf42dec6e91ecdf4aa5f0f007559684369a4..96d0d3c057fad35fe5fe0e0d7be71992c462ad7e 100644 (file)
 #define MASK_ALWAYS_GOOD       0x0000001F
 #define MASK_USER_GOOD         0x00401F00
 
+/*****************************************************************************
+ stubb functions
+****************************************************************************/
+
+void become_root( void )
+{
+        return;
+}
+
+void unbecome_root( void )
+{
+        return;
+}
+
+
 /*********************************************************
  Add all currently available users to another db
  ********************************************************/
@@ -91,7 +106,7 @@ static int export_groups (struct pdb_context *in, struct pdb_context *out) {
 
        if (NT_STATUS_IS_ERR(in->pdb_enum_group_mapping(in, SID_NAME_UNKNOWN,
                                                        &maps, &entries,
-                                                       False, False))) {
+                                                       False))) {
                fprintf(stderr, "Can't get group mappings!\n");
                return 1;
        }
@@ -157,8 +172,7 @@ 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));
                        
@@ -170,8 +184,7 @@ static int print_sam_info (SAM_ACCOUNT *sam_pwent, BOOL verbosity, BOOL smbpwdst
                       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);
+               uid = nametouid(pdb_get_username(sam_pwent));
                printf ("%s:%d:%s\n", pdb_get_username(sam_pwent), uid, pdb_get_fullname(sam_pwent));
        }
 
@@ -337,7 +350,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;
        }
@@ -485,7 +498,7 @@ static int delete_user_entry (struct pdb_context *in, const char *username)
                return -1;
        }
 
-       if (NT_STATUS_IS_ERR(in->pdb_getsampwnam(in, samaccount, username))) {
+       if (!NT_STATUS_IS_OK(in->pdb_getsampwnam(in, samaccount, username))) {
                fprintf (stderr, "user %s does not exist in the passdb\n", username);
                return -1;
        }
@@ -511,7 +524,7 @@ static int delete_machine_entry (struct pdb_context *in, const char *machinename
                return -1;
        }
 
-       if (NT_STATUS_IS_ERR(in->pdb_getsampwnam(in, samaccount, name))) {
+       if (!NT_STATUS_IS_OK(in->pdb_getsampwnam(in, samaccount, name))) {
                fprintf (stderr, "machine %s does not exist in the passdb\n", name);
                return -1;
        }
@@ -606,13 +619,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) +