r13576: This is the beginnings of moving the SAM_ACCOUNT data structure
[kai/samba.git] / source3 / utils / smbpasswd.c
index 4323ee29e0ceed72821cf83f497a28af90c89335..61e97fd692f8bb800ddbcd2e99c691d33e7f7c82 100644 (file)
@@ -196,48 +196,6 @@ static int process_options(int argc, char **argv, int local_flags)
        return local_flags;
 }
 
-/*************************************************************
- Utility function to prompt for passwords from stdin. Each
- password entered must end with a newline.
-*************************************************************/
-static char *stdin_new_passwd(void)
-{
-       static fstring new_pw;
-       size_t len;
-
-       ZERO_ARRAY(new_pw);
-
-       /*
-        * if no error is reported from fgets() and string at least contains
-        * the newline that ends the password, then replace the newline with
-        * a null terminator.
-        */
-       if ( fgets(new_pw, sizeof(new_pw), stdin) != NULL) {
-               if ((len = strlen(new_pw)) > 0) {
-                       if(new_pw[len-1] == '\n')
-                               new_pw[len - 1] = 0; 
-               }
-       }
-       return(new_pw);
-}
-
-
-/*************************************************************
- Utility function to get passwords via tty or stdin
- Used if the '-s' option is set to silently get passwords
- to enable scripting.
-*************************************************************/
-static char *get_pass( const char *prompt, BOOL stdin_get)
-{
-       char *p;
-       if (stdin_get) {
-               p = stdin_new_passwd();
-       } else {
-               p = getpass(prompt);
-       }
-       return smb_xstrdup(p);
-}
-
 /*************************************************************
  Utility function to prompt for new password.
 *************************************************************/
@@ -373,7 +331,7 @@ static int process_root(int local_flags)
 
        if (!user_name[0] && (pwd = getpwuid_alloc(NULL, geteuid()))) {
                fstrcpy(user_name, pwd->pw_name);
-               talloc_free(pwd);
+               TALLOC_FREE(pwd);
        } 
 
        if (!user_name[0]) {
@@ -443,7 +401,7 @@ static int process_root(int local_flags)
                         */
                        
                        if(local_flags & LOCAL_ENABLE_USER) {
-                               SAM_ACCOUNT *sampass = NULL;
+                               struct samu *sampass = NULL;
                                BOOL ret;
                                
                                pdb_init_sam(&sampass);
@@ -452,7 +410,7 @@ static int process_root(int local_flags)
                                   (pdb_get_lanman_passwd(sampass) == NULL)) {
                                        local_flags |= LOCAL_SET_PASSWORD;
                                }
-                               pdb_free_sam(&sampass);
+                               TALLOC_FREE(sampass);
                        }
                }
                
@@ -477,7 +435,7 @@ static int process_root(int local_flags)
        if(remote_machine) {
                printf("Password changed for user %s on %s.\n", user_name, remote_machine );
        } else if(!(local_flags & (LOCAL_ADD_USER|LOCAL_DISABLE_USER|LOCAL_ENABLE_USER|LOCAL_DELETE_USER|LOCAL_SET_NO_PASSWORD|LOCAL_SET_PASSWORD))) {
-               SAM_ACCOUNT *sampass = NULL;
+               struct samu *sampass = NULL;
                BOOL ret;
                
                pdb_init_sam(&sampass);
@@ -489,7 +447,7 @@ static int process_root(int local_flags)
                if((ret != False) && (pdb_get_acct_ctrl(sampass) & ACB_PWNOTREQ) )
                        printf(" User has no password flag set.");
                printf("\n");
-               pdb_free_sam(&sampass);
+               TALLOC_FREE(sampass);
        }
 
  done:
@@ -518,7 +476,7 @@ static int process_nonroot(int local_flags)
                pwd = getpwuid_alloc(NULL, getuid());
                if (pwd) {
                        fstrcpy(user_name,pwd->pw_name);
-                       talloc_free(pwd);
+                       TALLOC_FREE(pwd);
                } else {
                        fprintf(stderr, "smbpasswd: cannot lookup user name for uid %u\n", (unsigned int)getuid());
                        exit(1);