[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Jan 22 14:53:04 MST 2015


The branch, master has been updated
       via  7afff0c s3-pam_smbpass: Correctly initialize variables.
       via  cb27bd1 s3-pam_smbpass: Remove superfluous NULL check for pam functions.
       via  29cfa2a s3-pam_smbpass: Make sure PAM_MAXTRIES can be returned.
       via  016bee9 s3-pam_smbpass: Check the return code of secrets_init().
       via  bc0768c s3-pam_smbpass: Fix set_ctrl() return value.
       via  7bbf221 s3-pam_smbpass: Make sure variables are initialized.
       via  eb1bf81 s3-smbspool: Use strtol() instead of atoi().
      from  63552f1 winbind: Fix idmap initialization

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7afff0c52e6b1af7534fc7b410bcd67611a5a08f
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jan 22 10:16:28 2015 +0100

    s3-pam_smbpass: Correctly initialize variables.
    
    This fixes a coverity warning.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Jan 22 22:51:59 CET 2015 on sn-devel-104

commit cb27bd1022caa42ccbf37e827347c13fa54619c6
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jan 22 10:13:37 2015 +0100

    s3-pam_smbpass: Remove superfluous NULL check for pam functions.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 29cfa2a7141784086a46e94e7cf6556a7360b6be
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jan 22 10:05:41 2015 +0100

    s3-pam_smbpass: Make sure PAM_MAXTRIES can be returned.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 016bee95e39db09f8d9df99ab467f574cecca946
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jan 22 09:51:10 2015 +0100

    s3-pam_smbpass: Check the return code of secrets_init().
    
    This fixes a coverity warning.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit bc0768c9645251d62d8131987000d5111d84c948
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jan 22 09:50:01 2015 +0100

    s3-pam_smbpass: Fix set_ctrl() return value.
    
    This fixes a cppcheck warning.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7bbf221cfd7fa82423149ba341fed115fa4b3e6b
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jan 22 09:40:53 2015 +0100

    s3-pam_smbpass: Make sure variables are initialized.
    
    This fixes cppcheck warnings.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit eb1bf816b6fb0e3bc9b8a872e59223e552545bf2
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jan 22 09:57:58 2015 +0100

    s3-smbspool: Use strtol() instead of atoi().
    
    This fixes a coverity warning.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/client/smbspool.c            |  9 ++++++++-
 source3/pam_smbpass/pam_smb_auth.c   |  3 ---
 source3/pam_smbpass/pam_smb_passwd.c |  4 ++--
 source3/pam_smbpass/support.c        | 20 ++++++++++++++------
 source3/pam_smbpass/support.h        |  2 +-
 5 files changed, 25 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index ddae1a6..21110b7 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.c
@@ -151,7 +151,14 @@ main(int argc,			/* I - Number of command-line arguments */
 		perror("ERROR: Unable to open print file");
 		goto done;
 	} else {
-		copies = atoi(argv[4]);
+		char *p = argv[4];
+		char *endp;
+
+		copies = strtol(p, &endp, 10);
+		if (p == endp) {
+			perror("ERROR: Unable to determine number of copies");
+			goto done;
+		}
 	}
 
 	/*
diff --git a/source3/pam_smbpass/pam_smb_auth.c b/source3/pam_smbpass/pam_smb_auth.c
index 1b8ae5e..ea25d77 100644
--- a/source3/pam_smbpass/pam_smb_auth.c
+++ b/source3/pam_smbpass/pam_smb_auth.c
@@ -214,9 +214,6 @@ static int _smb_add_user(pam_handle_t *pamh, unsigned int ctrl,
 			, "pam_get_item returned error to pam_sm_authenticate" );
 		TALLOC_FREE(frame);
 		return PAM_AUTHTOK_RECOVER_ERR;
-	} else if (pass == NULL) {
-		TALLOC_FREE(frame);
-		return PAM_AUTHTOK_RECOVER_ERR;
 	}
 
 	/* Add the user to the db if they aren't already there. */
diff --git a/source3/pam_smbpass/pam_smb_passwd.c b/source3/pam_smbpass/pam_smb_passwd.c
index dedfda0..87282b5 100644
--- a/source3/pam_smbpass/pam_smb_passwd.c
+++ b/source3/pam_smbpass/pam_smb_passwd.c
@@ -101,8 +101,8 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
     struct samu *sampass = NULL;
     void (*oldsig_handler)(int);
     const char *user;
-    char *pass_old;
-    char *pass_new;
+    char *pass_old = NULL;
+    char *pass_new = NULL;
     TALLOC_CTX *frame = talloc_stackframe();
 
     /* Samba initialization. */
diff --git a/source3/pam_smbpass/support.c b/source3/pam_smbpass/support.c
index e79d787..c49c2c5 100644
--- a/source3/pam_smbpass/support.c
+++ b/source3/pam_smbpass/support.c
@@ -122,7 +122,7 @@ int converse( pam_handle_t * pamh, int ctrl, int nargs
 	      , struct pam_response **response )
 {
 	int retval;
-	struct pam_conv *conv;
+	struct pam_conv *conv = NULL;
 
 	retval = _pam_get_item(pamh, PAM_CONV, &conv);
 	if (retval == PAM_SUCCESS) {
@@ -162,11 +162,15 @@ int make_remark( pam_handle_t * pamh, unsigned int ctrl
 
 /* set the control flags for the SMB module. */
 
-int set_ctrl( pam_handle_t *pamh, int flags, int argc, const char **argv )
+unsigned int set_ctrl(pam_handle_t *pamh,
+		      int flags,
+		      int argc,
+		      const char **argv)
 {
     int i = 0;
     const char *service_file = NULL;
     unsigned int ctrl;
+    bool ok;
 
     ctrl = SMB_DEFAULTS;	/* the default selection of options */
 
@@ -207,7 +211,10 @@ int set_ctrl( pam_handle_t *pamh, int flags, int argc, const char **argv )
 	_log_err(pamh, LOG_ERR, "Error loading service file %s", service_file);
     }
 
-    secrets_init();
+	ok = secrets_init();
+	if (!ok) {
+		_log_err(pamh, LOG_ERR, "Error loading secrets database");
+	}
 
     if (lp_null_passwords()) {
         set( SMB__NULLOK, ctrl );
@@ -370,7 +377,7 @@ int _smb_verify_password( pam_handle_t * pamh, struct samu *sampass,
         { /* this means we've succeeded */
             return PAM_SUCCESS;
         } else {
-            const char *service;
+            const char *service = NULL;
 
             _pam_get_item( pamh, PAM_SERVICE, &service );
             _log_err(pamh, LOG_NOTICE, "failed auth request by %s for service %s as %s",
@@ -402,7 +409,9 @@ int _smb_verify_password( pam_handle_t * pamh, struct samu *sampass,
         }
     } else {
 
-        const char *service;
+        const char *service = NULL;
+
+        retval = PAM_AUTH_ERR;
 
         _pam_get_item( pamh, PAM_SERVICE, &service );
 
@@ -453,7 +462,6 @@ int _smb_verify_password( pam_handle_t * pamh, struct samu *sampass,
                   "failed auth request by %s for service %s as %s(%d)",
                   uidtoname(getuid()),
                   service ? service : "**unknown**", name);
-        retval = PAM_AUTH_ERR;
     }
 
     _pam_delete( data_name );
diff --git a/source3/pam_smbpass/support.h b/source3/pam_smbpass/support.h
index 7ee7704..832247d 100644
--- a/source3/pam_smbpass/support.h
+++ b/source3/pam_smbpass/support.h
@@ -2,7 +2,7 @@
 extern void _log_err(pam_handle_t *, int, const char *, ...);
 
 /* set the control flags for the UNIX module. */
-extern int set_ctrl(pam_handle_t *, int, int, const char **);
+extern unsigned int set_ctrl(pam_handle_t *, int, int, const char **);
 
 /* generic function for freeing pam data segments */
 extern void _cleanup(pam_handle_t *, void *, int);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list