summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-05-22 20:35:48 +0000
committerJeremy Allison <jra@samba.org>2001-05-22 20:35:48 +0000
commitfaa0bef196b732b45c4614acd655af4881504808 (patch)
treeea629d40dcd14be6fcdf1ced898971a2dd54a173 /source3/smbd
parent58339ac6ccf6e6d264dfbfd6bf9bcf336e90256d (diff)
downloadsamba-faa0bef196b732b45c4614acd655af4881504808.tar.gz
samba-faa0bef196b732b45c4614acd655af4881504808.tar.bz2
samba-faa0bef196b732b45c4614acd655af4881504808.zip
Defensive brlock and locking database cleaning code.
Jeremy. (This used to be commit d7aa42e4593b02ee6e487f7a4633bd7e7620ef2f)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/reply.c82
1 files changed, 40 insertions, 42 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 2e4837013e..b43512329e 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -603,57 +603,55 @@ static BOOL check_domain_security(char *orig_user, char *domain, char *unix_user
char *smb_apasswd, int smb_apasslen,
char *smb_ntpasswd, int smb_ntpasslen)
{
- BOOL ret = False;
- BOOL user_exists = True;
- struct passwd *pwd=NULL;
+ BOOL ret = False;
+ BOOL user_exists = True;
+ struct passwd *pwd=NULL;
- if(lp_security() != SEC_DOMAIN)
- return False;
+ if(lp_security() != SEC_DOMAIN)
+ return False;
- if (!check_domain_match(orig_user, domain))
- return False;
+ if (!check_domain_match(orig_user, domain))
+ return False;
- ret = domain_client_validate(orig_user, domain,
- smb_apasswd, smb_apasslen,
- smb_ntpasswd, smb_ntpasslen,
- &user_exists, NULL);
+ ret = domain_client_validate(orig_user, domain,
+ smb_apasswd, smb_apasslen,
+ smb_ntpasswd, smb_ntpasslen,
+ &user_exists, NULL);
- if(ret) {
- /*
- * User validated ok against Domain controller.
- * If the admin wants us to try and create a UNIX
- * user on the fly, do so.
- */
- if(user_exists && lp_adduser_script() && !(pwd = smb_getpwnam(unix_user,True))) {
- smb_create_user(unix_user, NULL);
- }
+ if(ret) {
+ /*
+ * User validated ok against Domain controller.
+ * If the admin wants us to try and create a UNIX
+ * user on the fly, do so.
+ */
+ if(user_exists && lp_adduser_script() && !(pwd = smb_getpwnam(unix_user,True)))
+ smb_create_user(unix_user, NULL);
- if(lp_adduser_script() && pwd) {
- SMB_STRUCT_STAT st;
+ if(lp_adduser_script() && pwd) {
+ SMB_STRUCT_STAT st;
- /*
- * Also call smb_create_user if the users home directory
- * doesn't exist. Used with winbindd to allow the script to
- * create the home directory for a user mapped with winbindd.
- */
+ /*
+ * Also call smb_create_user if the users home directory
+ * doesn't exist. Used with winbindd to allow the script to
+ * create the home directory for a user mapped with winbindd.
+ */
- if (pwd->pw_shell && (sys_stat(pwd->pw_dir, &st) == -1) && (errno == ENOENT))
- smb_create_user(unix_user, pwd->pw_dir);
- }
+ if (pwd->pw_dir && (sys_stat(pwd->pw_dir, &st) == -1) && (errno == ENOENT))
+ smb_create_user(unix_user, pwd->pw_dir);
+ }
- } else {
- /*
- * User failed to validate ok against Domain controller.
- * If the failure was "user doesn't exist" and admin
- * wants us to try and delete that UNIX user on the fly,
- * do so.
- */
- if(!user_exists && lp_deluser_script() && smb_getpwnam(unix_user,True)) {
- smb_delete_user(unix_user);
- }
- }
+ } else {
+ /*
+ * User failed to validate ok against Domain controller.
+ * If the failure was "user doesn't exist" and admin
+ * wants us to try and delete that UNIX user on the fly,
+ * do so.
+ */
+ if(!user_exists && lp_deluser_script() && smb_getpwnam(unix_user,True))
+ smb_delete_user(unix_user);
+ }
- return ret;
+ return ret;
}
/****************************************************************************