Commit the auth associated changes I missed from the last commit.
authorAndrew Bartlett <abartlet@samba.org>
Tue, 15 Jan 2002 01:14:58 +0000 (01:14 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 15 Jan 2002 01:14:58 +0000 (01:14 +0000)
Also set the default value of all the allocated strings to "" to avoid changing
the interface (becouse pdb_get...() would point to a null string, rather than a
null pointer and parts of samba rely on that).

Andrew Bartlett

source/auth/auth_sam.c
source/auth/auth_util.c
source/passdb/passdb.c
source/passdb/pdb_get_set.c

index 107e33c60002e16dccfcf5ec7084ddeaf6a9b1ee..01f41fce441bac8fa4d1c83eabb7be561275843b 100644 (file)
@@ -353,8 +353,10 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
                return NT_STATUS_UNSUCCESSFUL;
        }
 
-       if (!pdb_init_sam(&sampass)) {
-               return NT_STATUS_NO_MEMORY;
+       /* Can't use the talloc version here, becouse the returned struct gets
+          kept on the server_info */
+       if (!NT_STATUS_IS_OK(nt_status = pdb_init_sam(&sampass))) {
+               return nt_status;
        }
 
        /* get the account information */
index a747cf8a35183b672552d3821b85f7fb1e9cfa25..d2748e30d45e08faee085ad482c649fa18d66e83 100644 (file)
@@ -501,7 +501,7 @@ BOOL make_server_info_sam(auth_serversupplied_info **server_info, SAM_ACCOUNT *s
 BOOL make_server_info_pw(auth_serversupplied_info **server_info, const struct passwd *pwd)
 {
        SAM_ACCOUNT *sampass = NULL;
-       if (!pdb_init_sam_pw(&sampass, pwd)) {          
+       if (!NT_STATUS_IS_OK(pdb_init_sam_pw(&sampass, pwd))) {         
                return False;
        }
        return make_server_info_sam(server_info, sampass);
index 39a8fb36769ca046d52b0cdc85ffcaf9bd80606b..92447b3766c9b45dad0d43b3bc2115f266c2b3d5 100644 (file)
@@ -80,6 +80,21 @@ static void pdb_fill_default_sam(SAM_ACCOUNT *user)
        memset(user->private.hours, 0xff, user->private.hours_len); /* available at all hours */
        user->private.unknown_5 = 0x00000000; /* don't know */
        user->private.unknown_6 = 0x000004ec; /* don't know */
+
+       /* Some parts of samba strlen their pdb_get...() returns, 
+          so this keeps the interface unchanged for now. */
+          
+       user->private.username = "";
+       user->private.domain = "";
+       user->private.nt_username = "";
+       user->private.full_name = "";
+       user->private.home_dir = "";
+       user->private.logon_script = "";
+       user->private.profile_path = "";
+       user->private.acct_desc = "";
+       user->private.workstations = "";
+       user->private.unknown_str = "";
+       user->private.munged_dial = "";
 }      
 
 static void destroy_pdb_talloc(SAM_ACCOUNT **user) 
index 0dd0f21c37b94f573853f08284182fcd61840d87..db7ab11bb780e45a28d59194496ae682ed666c42 100644 (file)
@@ -28,6 +28,7 @@
  * @todo Redefine this to NULL, but this changes the API becouse
  *       much of samba assumes that the pdb_get...() funtions 
  *       return pstrings.  (ie not null-pointers).
+ *       See also pdb_fill_default_sam().
  */
 
 #define PDB_NOT_QUITE_NULL ""