[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Wed Dec 12 08:41:01 MST 2012


The branch, master has been updated
       via  a44e58a s3: Fix a typo in a debug message
       via  880b0f1 s3-printing: Correctly create the printing cache path.
       via  76ac4d9 s3-registry: Fix counters_directory() dir creation.
       via  7dd1350 s4-socket: Make sure unix socket addresses are null terminated.
       via  07385a8 s3-ctdb: Make sure addr.sun_path is null terminated.
       via  ef0a945 torture: Make sure we use the correct size for cxd.
       via  b4884dc s3-libsmb: Fix possible comparsion problems.
       via  b4accd3 s4-libcli: Fix comparison of chosen_oid.
       via  f670cae s3-utils: Correctly handle getenv() for the later system() call.
       via  34a1886 s4-client: Make sure we have a valid count if we goto cleanup.
       via  d55c6e7 s3-utils: Cleanup code in wait_replies().
       via  1dc414e nsswitch: Fix pam_get_{item,data} build warnings.
       via  de22df1 nsswitch: Remove unused variable in _pam_winbind_change_pwd().
       via  b8ed2ef nsswitch: Cleanup code in parse_wbinfo_domain_user().
       via  af18339 s4-libnet: Don't call talloc_get_type() for the same struct twice.
       via  3bcd14c s3-nmbd: Cleanup code to make it more readable.
       via  e5deaa2 s3-lib: Remove unsused variable from sys_get_nfs_quota().
       via  62646b7 winbind: Use talloc in resolve_username_to_alias().
       via  d862bbd winbind: Use talloc in resolve_alias_to_username().
      from  c905379 tdb: Improve the documentation of tdb_reopen() and tdb_close().

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


- Log -----------------------------------------------------------------
commit a44e58a31ebecd6f467ffdac6645ffe6a313e9c6
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Dec 12 12:55:45 2012 +0100

    s3: Fix a typo in a debug message
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Wed Dec 12 16:40:23 CET 2012 on sn-devel-104

commit 880b0f18bede936bafb806669ee4d160567e90bb
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Dec 10 17:52:50 2012 +0100

    s3-printing: Correctly create the printing cache path.
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit 76ac4d923d7ea07ab13190217359ce283e925fac
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Dec 10 17:45:15 2012 +0100

    s3-registry: Fix counters_directory() dir creation.
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit 7dd13503c0919766ecf3c8f5f48cda72aae8ac73
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Dec 10 17:14:12 2012 +0100

    s4-socket: Make sure unix socket addresses are null terminated.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit 07385a851f6c07c9f8ef4414d8483de7106ee486
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Dec 10 17:07:24 2012 +0100

    s3-ctdb: Make sure addr.sun_path is null terminated.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit ef0a945bf8e6310acb41f90a2179e61d412a61ea
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Dec 10 17:06:39 2012 +0100

    torture: Make sure we use the correct size for cxd.
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit b4884dcff7362d585d93c3acf08e8c4835d918d0
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Dec 10 15:11:23 2012 +0100

    s3-libsmb: Fix possible comparsion problems.
    
    This makes the code also easier to understand.
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit b4accd365d4758f3f4453083c24c59615051d863
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Dec 10 15:02:43 2012 +0100

    s4-libcli: Fix comparison of chosen_oid.
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit f670cae69d85a8bfc14ab7d9cd38ab0e568e6929
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Dec 10 14:06:32 2012 +0100

    s3-utils: Correctly handle getenv() for the later system() call.
    
    The returned string of getenv() has an unknown size. You need to store
    the result always in a char array with a certain size to make sure we
    don't feed tainted data to the next function call.
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit 34a18865d6d2acd05e93fc728510896e69449d79
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 6 18:04:41 2012 +0100

    s4-client: Make sure we have a valid count if we goto cleanup.
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit d55c6e7113efb9214f606dd183e5214a03f6dcae
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 6 15:40:29 2012 +0100

    s3-utils: Cleanup code in wait_replies().
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit 1dc414e4d22e5d8c77aba2100b6c6c2e3effc00c
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 6 15:28:03 2012 +0100

    nsswitch: Fix pam_get_{item,data} build warnings.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit de22df1419d205a5baf1ad1a4779ef2afe51f0f9
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 6 15:16:52 2012 +0100

    nsswitch: Remove unused variable in _pam_winbind_change_pwd().
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit b8ed2efb50b4a689e02b86d4c626d96ee7b2717f
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 6 15:14:07 2012 +0100

    nsswitch: Cleanup code in parse_wbinfo_domain_user().
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit af18339e037e388ddac4a417544c295bcc44b31d
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 6 15:11:09 2012 +0100

    s4-libnet: Don't call talloc_get_type() for the same struct twice.
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit 3bcd14c3970f3be58d8f0d802b905c64661173a6
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 6 15:06:06 2012 +0100

    s3-nmbd: Cleanup code to make it more readable.
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit e5deaa29689ca53b5ba96836ff787281fdba06f1
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 6 14:35:48 2012 +0100

    s3-lib: Remove unsused variable from sys_get_nfs_quota().
    
    testpath is the same a few lines later.
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit 62646b7666178bf03cd650056a61338e84b54b25
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 6 11:40:35 2012 +0100

    winbind: Use talloc in resolve_username_to_alias().
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

commit d862bbd5dcffa3f1cb8e774724132a39b55dbd9f
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 6 11:24:17 2012 +0100

    winbind: Use talloc in resolve_alias_to_username().
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>

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

Summary of changes:
 nsswitch/pam_winbind.c                   |   50 +++++++++--------------------
 nsswitch/wbinfo.c                        |    3 +-
 source3/lib/ctdbd_conn.c                 |    2 +-
 source3/lib/sysquotas_nfs.c              |    3 +-
 source3/libsmb/libsmb_printjob.c         |   28 ++++++++++++----
 source3/nmbd/nmbd_browsesync.c           |   10 ++++--
 source3/printing/printing.c              |    7 +++-
 source3/registry/reg_perfcount.c         |    4 +-
 source3/utils/interact.c                 |   17 ++++++----
 source3/utils/smbcontrol.c               |    7 ++--
 source3/winbindd/winbindd.c              |    2 +-
 source3/winbindd/winbindd_cache.c        |   16 ++++++---
 source4/client/client.c                  |    3 +-
 source4/lib/socket/socket_unix.c         |   10 +++---
 source4/libcli/smb_composite/sesssetup.c |    2 +-
 source4/libnet/libnet_rpc.c              |    4 +-
 source4/torture/basic/denytest.c         |    5 ++-
 17 files changed, 94 insertions(+), 79 deletions(-)


Changeset truncated at 500 lines:

diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index 29d6f7c..682af8e 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -164,25 +164,6 @@ static inline void textdomain_init(void)
 #endif
 
 
-/*
- * Work around the pam API that has functions with void ** as parameters
- * These lead to strict aliasing warnings with gcc.
- */
-static int _pam_get_item(const pam_handle_t *pamh,
-			 int item_type,
-			 const void *_item)
-{
-	const void **item = (const void **)_item;
-	return pam_get_item(pamh, item_type, item);
-}
-static int _pam_get_data(const pam_handle_t *pamh,
-			 const char *module_data_name,
-			 const void *_data)
-{
-	const void **data = (const void **)_data;
-	return pam_get_data(pamh, module_data_name, data);
-}
-
 /* some syslogging */
 
 #ifdef HAVE_PAM_VSYSLOG
@@ -202,7 +183,7 @@ static void _pam_log_int(const pam_handle_t *pamh,
 	char *format2 = NULL;
 	const char *service;
 
-	_pam_get_item(pamh, PAM_SERVICE, &service);
+	pam_get_item(pamh, PAM_SERVICE, (const void **) &service);
 
 	format2 = (char *)malloc(strlen(MODULE_NAME)+strlen(format)+strlen(service)+5);
 	if (format2 == NULL) {
@@ -645,7 +626,7 @@ static int converse(const pam_handle_t *pamh,
 	int retval;
 	struct pam_conv *conv;
 
-	retval = _pam_get_item(pamh, PAM_CONV, &conv);
+	retval = pam_get_item(pamh, PAM_CONV, (const void **) &conv);
 	if (retval == PAM_SUCCESS) {
 		retval = conv->conv(nargs,
 				    (const struct pam_message **)message,
@@ -812,13 +793,11 @@ static bool _pam_winbind_change_pwd(struct pwb_context *ctx)
 {
 	struct pam_message msg, *pmsg;
 	struct pam_response *resp = NULL;
-	const char *prompt;
 	int ret;
 	bool retval = false;
-	prompt = _("Do you want to change your password now?");
 	pmsg = &msg;
 	msg.msg_style = PAM_RADIO_TYPE;
-	msg.msg = prompt;
+	msg.msg = _("Do you want to change your password now?");
 	ret = converse(ctx->pamh, 1, &pmsg, &resp);
 	if (resp == NULL) {
 		if (ret == PAM_SUCCESS) {
@@ -2123,7 +2102,9 @@ static int _winbind_read_password(struct pwb_context *ctx,
 
 	if (on(WINBIND_TRY_FIRST_PASS_ARG, ctrl) ||
 	    on(WINBIND_USE_FIRST_PASS_ARG, ctrl)) {
-		retval = _pam_get_item(ctx->pamh, authtok_flag, &item);
+		retval = pam_get_item(ctx->pamh,
+				      authtok_flag,
+				      (const void **) &item);
 		if (retval != PAM_SUCCESS) {
 			/* very strange. */
 			_pam_log(ctx, LOG_ALERT,
@@ -2231,7 +2212,7 @@ static int _winbind_read_password(struct pwb_context *ctx,
 	retval = pam_set_item(ctx->pamh, authtok_flag, token);
 	_pam_delete(token);	/* clean it up */
 	if (retval != PAM_SUCCESS ||
-	    (retval = _pam_get_item(ctx->pamh, authtok_flag, &item)) != PAM_SUCCESS) {
+	    (retval = pam_get_item(ctx->pamh, authtok_flag, (const void **) &item)) != PAM_SUCCESS) {
 
 		_pam_log(ctx, LOG_CRIT, "error manipulating password");
 		return retval;
@@ -2802,7 +2783,7 @@ int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
 {
 	const char *username;
 	int ret = PAM_USER_UNKNOWN;
-	void *tmp = NULL;
+	const char *tmp = NULL;
 	struct pwb_context *ctx = NULL;
 
 	ret = _pam_winbind_init_context(pamh, flags, argc, argv, &ctx);
@@ -2843,7 +2824,7 @@ int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
 		pam_get_data(pamh, PAM_WINBIND_NEW_AUTHTOK_REQD,
 			     (const void **)&tmp);
 		if (tmp != NULL) {
-			ret = atoi((const char *)tmp);
+			ret = atoi(tmp);
 			switch (ret) {
 			case PAM_AUTHTOK_EXPIRED:
 				/* fall through, since new token is required in this case */
@@ -2969,8 +2950,8 @@ static bool _pam_require_krb5_auth_after_chauthtok(struct pwb_context *ctx,
 	char *new_authtok_reqd_during_auth = NULL;
 	struct passwd *pwd = NULL;
 
-	_pam_get_data(ctx->pamh, PAM_WINBIND_NEW_AUTHTOK_REQD_DURING_AUTH,
-		      &new_authtok_reqd_during_auth);
+	pam_get_data(ctx->pamh, PAM_WINBIND_NEW_AUTHTOK_REQD_DURING_AUTH,
+		      (const void **) &new_authtok_reqd_during_auth);
 	pam_set_data(ctx->pamh, PAM_WINBIND_NEW_AUTHTOK_REQD_DURING_AUTH,
 		     NULL, NULL);
 
@@ -3001,7 +2982,8 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
 
 	/* <DO NOT free() THESE> */
 	const char *user;
-	char *pass_old, *pass_new;
+	const char *pass_old;
+	const char *pass_new;
 	/* </DO NOT free() THESE> */
 
 	char *Announce;
@@ -3124,7 +3106,7 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
 		 * get the old token back.
 		 */
 
-		ret = _pam_get_item(pamh, PAM_OLDAUTHTOK, &pass_old);
+		ret = pam_get_item(pamh, PAM_OLDAUTHTOK, (const void **) &pass_old);
 
 		if (ret != PAM_SUCCESS) {
 			_pam_log(ctx, LOG_NOTICE,
@@ -3174,8 +3156,8 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
 		 * By reaching here we have approved the passwords and must now
 		 * rebuild the password database file.
 		 */
-		_pam_get_data(pamh, PAM_WINBIND_PWD_LAST_SET,
-			      &pwdlastset_update);
+		pam_get_data(pamh, PAM_WINBIND_PWD_LAST_SET,
+			     (const void **) &pwdlastset_update);
 
 		/*
 		 * if cached creds were enabled, make sure to set the
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index 0e102dc..b96b73c 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -121,7 +121,8 @@ static bool parse_wbinfo_domain_user(const char *domuser, fstring domain,
 
 	if (!p) {
 		/* Maybe it was a UPN? */
-		if ((p = strchr(domuser, '@')) != NULL) {
+		p = strchr(domuser, '@');
+		if (p != NULL) {
 			fstrcpy(domain, "");
 			fstrcpy(user, domuser);
 			return true;
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 84f26e0..5417c67 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -213,7 +213,7 @@ static NTSTATUS ctdbd_connect(TALLOC_CTX *mem_ctx,
 
 	ZERO_STRUCT(addr);
 	addr.sun_family = AF_UNIX;
-	strncpy(addr.sun_path, sockname, sizeof(addr.sun_path));
+	snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", sockname);
 
 	salen = sizeof(struct sockaddr_un);
 	if (connect(fd, (struct sockaddr *)(void *)&addr, salen) == -1) {
diff --git a/source3/lib/sysquotas_nfs.c b/source3/lib/sysquotas_nfs.c
index ad98152..63f114b 100644
--- a/source3/lib/sysquotas_nfs.c
+++ b/source3/lib/sysquotas_nfs.c
@@ -107,7 +107,7 @@ int sys_get_nfs_quota(const char *path, const char *bdev,
 	struct getquota_rslt gq_rslt;
 	struct getquota_args gq_args;
 	const char *mnttype;
-	char *cutstr, *pathname, *host, *testpath;
+	char *cutstr, *host, *testpath;
 	int len;
 	static struct timeval timeout = {2,0};
 	enum clnt_stat clnt_stat;
@@ -136,7 +136,6 @@ int sys_get_nfs_quota(const char *path, const char *bdev,
 
 	mnttype = bdev;
 	len = strcspn(mnttype, ":");
-	pathname = strstr(mnttype, ":");
 	cutstr = (char *) SMB_MALLOC(len+1);
 	if (cutstr == NULL) {
 		errno = ENOMEM;
diff --git a/source3/libsmb/libsmb_printjob.c b/source3/libsmb/libsmb_printjob.c
index db46cee..173fa32 100644
--- a/source3/libsmb/libsmb_printjob.c
+++ b/source3/libsmb/libsmb_printjob.c
@@ -93,6 +93,8 @@ SMBC_print_file_ctx(SMBCCTX *c_file,
 {
         SMBCFILE *fid1;
         SMBCFILE *fid2;
+        smbc_open_fn f_open1;
+        smbc_open_print_job_fn f_open_pj2;
         int bytes;
         int saverr;
         int tot_bytes = 0;
@@ -113,18 +115,30 @@ SMBC_print_file_ctx(SMBCCTX *c_file,
         }
 
         /* Try to open the file for reading ... */
+	f_open1 = smbc_getFunctionOpen(c_file);
+	if (f_open1 == NULL) {
+		errno = EINVAL;
+		TALLOC_FREE(frame);
+		return -1;
+	}
 
-        if ((long)(fid1 = smbc_getFunctionOpen(c_file)(c_file, fname,
-                                                       O_RDONLY, 0666)) < 0) {
-                DEBUG(3, ("Error, fname=%s, errno=%i\n", fname, errno));
+	fid1 = f_open1(c_file, fname, O_RDONLY, 0666);
+	if (fid1 < 0) {
+		DEBUG(3, ("Error, fname=%s, errno=%i\n", fname, errno));
 		TALLOC_FREE(frame);
-                return -1;  /* smbc_open sets errno */
-        }
+		return -1;  /* smbc_open sets errno */
+	}
 
         /* Now, try to open the printer file for writing */
+	f_open_pj2 = smbc_getFunctionOpenPrintJob(c_print);
+	if (f_open_pj2 == NULL) {
+		errno = EINVAL;
+		TALLOC_FREE(frame);
+		return -1;
+	}
 
-        if ((long)(fid2 = smbc_getFunctionOpenPrintJob(c_print)(c_print,
-                                                                printq)) < 0) {
+	fid2 = f_open_pj2(c_print, printq);
+	if (fid2 < 0) {
                 saverr = errno;  /* Save errno */
                 smbc_getFunctionClose(c_file)(c_file, fid1);
                 errno = saverr;
diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c
index b56baed..8bc28ad 100644
--- a/source3/nmbd/nmbd_browsesync.c
+++ b/source3/nmbd/nmbd_browsesync.c
@@ -402,7 +402,6 @@ static void get_domain_master_name_node_status_success(struct subnet_record *sub
                                               struct res_rec *answers,
                                               struct in_addr from_ip)
 {
-	struct work_record *work;
 	unstring server_name;
 
 	server_name[0] = 0;
@@ -443,6 +442,8 @@ static void get_domain_master_name_node_status_success(struct subnet_record *sub
 			}
 
 			if(!(nb_flags & NB_GROUP) && (name_type == 0x1b)) {
+				struct work_record *work;
+
 				if( DEBUGLVL( 5 ) ) {
 					dbgtext( "get_domain_master_name_node_status_success:\n" );
 					dbgtext( "%s(%s) ", server_name, inet_ntoa(from_ip) );
@@ -455,13 +456,16 @@ static void get_domain_master_name_node_status_success(struct subnet_record *sub
 				 * to the workgroup list on the unicast_subnet.
 				 */
 
-				if((work = find_workgroup_on_subnet( subrec, qname)) == NULL) {
+				work = find_workgroup_on_subnet( subrec, qname);
+				if (work == NULL) {
 					struct nmb_name nmbname;
 					/* 
 					 * Add it - with an hour in the cache.
 					 */
-					if(!(work= create_workgroup_on_subnet(subrec, qname, 60*60)))
+					work = create_workgroup_on_subnet(subrec, qname, 60*60);
+					if (work == NULL) {
 						return;
+					}
 
 					/* remember who the master is */
 					strlcpy(work->local_master_browser_name,
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index e0d6179..c394118 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -197,13 +197,18 @@ bool print_backend_init(struct messaging_context *msg_ctx)
 	const char *sversion = "INFO/version";
 	int services = lp_numservices();
 	int snum;
+	bool ok;
 
 	if (!printer_list_parent_init()) {
 		return false;
 	}
 
+	ok = directory_create_or_exist(cache_path("printing"), geteuid(), 0755);
+	if (!ok) {
+		return false;
+	}
+
 	unlink(cache_path("printing.tdb"));
-	mkdir(cache_path("printing"),0755);
 
 	/* handle a Samba upgrade */
 
diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c
index e51d374..cfefb1f 100644
--- a/source3/registry/reg_perfcount.c
+++ b/source3/registry/reg_perfcount.c
@@ -48,8 +48,8 @@ static char *counters_directory(const char *dbname)
 	TALLOC_CTX *ctx = talloc_tos();
 
 	path = state_path(PERFCOUNTDIR);
-	if (!directory_exist(path)) {
-		mkdir(path, 0755);
+	if (!directory_create_or_exist(path, geteuid(), 0755)) {
+		return NULL;
 	}
 
 	path = talloc_asprintf(ctx, "%s/%s", PERFCOUNTDIR, dbname);
diff --git a/source3/utils/interact.c b/source3/utils/interact.c
index 39ec707..6d753dd 100644
--- a/source3/utils/interact.c
+++ b/source3/utils/interact.c
@@ -31,16 +31,19 @@
 #include <termios.h>
 
 static const char* get_editor(void) {
-	static const char* editor = NULL;
-	if (editor == NULL) {
-		editor = getenv("VISUAL");
-		if (editor == NULL) {
-			editor = getenv("EDITOR");
+	static char editor[64] = {0};
+
+	if (editor[0] == '\0') {
+		const char *tmp = getenv("VISUAL");
+		if (tmp == NULL) {
+			tmp = getenv("EDITOR");
 		}
-		if (editor == NULL) {
-			editor = "vi";
+		if (tmp == NULL) {
+			tmp = "vi";
 		}
+		snprintf(editor, sizeof(editor), "%s", tmp);
 	}
+
 	return editor;
 }
 
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index f7a93d9..ac13dc4 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -93,9 +93,10 @@ static void wait_replies(struct tevent_context *ev_ctx,
 	struct tevent_timer *te;
 	bool timed_out = False;
 
-	if (!(te = tevent_add_timer(ev_ctx, NULL,
-				    timeval_current_ofs(timeout, 0),
-				    smbcontrol_timeout, (void *)&timed_out))) {
+	te = tevent_add_timer(ev_ctx, NULL,
+			      timeval_current_ofs(timeout, 0),
+			      smbcontrol_timeout, (void *)&timed_out);
+	if (te == NULL) {
 		DEBUG(0, ("tevent_add_timer failed\n"));
 		return;
 	}
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 654c14c..7e8a1b5 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -818,7 +818,7 @@ static void new_connection(int listen_sock, bool privileged)
 
 	if (sock == -1) {
 		if (errno != EINTR) {
-			DEBUG(0, ("Faild to accept socket - %s\n",
+			DEBUG(0, ("Failed to accept socket - %s\n",
 				  strerror(errno)));
 		}
 		return;
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index e3406a5..76970d6 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -1111,16 +1111,18 @@ NTSTATUS resolve_username_to_alias( TALLOC_CTX *mem_ctx,
 	if (!cache->tdb)
 		goto do_query;
 
-	if ( (upper_name = SMB_STRDUP(name)) == NULL )
+	upper_name = talloc_strdup(mem_ctx, name);
+	if (upper_name == NULL) {
 		return NT_STATUS_NO_MEMORY;
+	}
 	if (!strupper_m(upper_name)) {
-		SAFE_FREE(upper_name);
+		talloc_free(upper_name);
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
 	centry = wcache_fetch(cache, domain, "NSS/NA/%s", upper_name);
 
-	SAFE_FREE( upper_name );
+	talloc_free(upper_name);
 
 	if (!centry)
 		goto do_query;
@@ -1189,16 +1191,18 @@ NTSTATUS resolve_alias_to_username( TALLOC_CTX *mem_ctx,
 	if (!cache->tdb)
 		goto do_query;
 
-	if ( (upper_name = SMB_STRDUP(alias)) == NULL )
+	upper_name = talloc_strdup(mem_ctx, alias);
+	if (upper_name == NULL) {
 		return NT_STATUS_NO_MEMORY;
+	}
 	if (!strupper_m(upper_name)) {
-		SAFE_FREE(upper_name);
+		talloc_free(upper_name);
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
 	centry = wcache_fetch(cache, domain, "NSS/AN/%s", upper_name);
 
-	SAFE_FREE( upper_name );
+	talloc_free(upper_name);
 
 	if (!centry)
 		goto do_query;
diff --git a/source4/client/client.c b/source4/client/client.c
index d7adc41..1cd0e5d 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -2901,7 +2901,8 @@ static char **remote_completion(const char *text, int len)
 	info.samelen = len;
 	info.text = text;
 	info.len = len;
- 
+	info.count = 0;
+
 	if (len >= PATH_MAX)
 		return(NULL);
 
diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c
index 2909ecc..4755e79 100644
--- a/source4/lib/socket/socket_unix.c
+++ b/source4/lib/socket/socket_unix.c
@@ -113,7 +113,7 @@ static NTSTATUS unixdom_connect(struct socket_context *sock,
 		
 		ZERO_STRUCT(srv_addr);
 		srv_addr.sun_family = AF_UNIX;
-		strncpy(srv_addr.sun_path, srv_address->addr, sizeof(srv_addr.sun_path));
+		snprintf(srv_addr.sun_path, sizeof(srv_addr.sun_path), "%s", srv_address->addr);
 
 		ret = connect(sock->fd, (const struct sockaddr *)&srv_addr, sizeof(srv_addr));
 	}
@@ -148,8 +148,8 @@ static NTSTATUS unixdom_listen(struct socket_context *sock,
 		
 		ZERO_STRUCT(my_addr);
 		my_addr.sun_family = AF_UNIX;
-		strncpy(my_addr.sun_path, my_address->addr, sizeof(my_addr.sun_path));
-		
+		snprintf(my_addr.sun_path, sizeof(my_addr.sun_path), "%s", my_address->addr);
+
 		ret = bind(sock->fd, (struct sockaddr *)&my_addr, sizeof(my_addr));
 	}
 	if (ret == -1) {
@@ -278,8 +278,8 @@ static NTSTATUS unixdom_sendto(struct socket_context *sock,
 		
 		ZERO_STRUCT(srv_addr);
 		srv_addr.sun_family = AF_UNIX;
-		strncpy(srv_addr.sun_path, dest->addr, sizeof(srv_addr.sun_path));
-		
+		snprintf(srv_addr.sun_path, sizeof(srv_addr.sun_path), "%s", dest->addr);
+
 		len = sendto(sock->fd, blob->data, blob->length, 0, 
 			     (struct sockaddr *)&srv_addr, sizeof(srv_addr));
 	}
diff --git a/source4/libcli/smb_composite/sesssetup.c b/source4/libcli/smb_composite/sesssetup.c
index 4be1ea0..f305a5e 100644
--- a/source4/libcli/smb_composite/sesssetup.c
+++ b/source4/libcli/smb_composite/sesssetup.c
@@ -515,7 +515,7 @@ static NTSTATUS session_setup_spnego(struct composite_context *c,
 		}
 	}
 
-	if ((const void *)chosen_oid == (const void *)GENSEC_OID_SPNEGO) {
+	if (strequal(chosen_oid, GENSEC_OID_SPNEGO)) {
 		status = gensec_update(session->gensec, state,
 				       c->event_ctx,
 				       session->transport->negotiate.secblob,
diff --git a/source4/libnet/libnet_rpc.c b/source4/libnet/libnet_rpc.c
index 349e1f8..1311528 100644
--- a/source4/libnet/libnet_rpc.c
+++ b/source4/libnet/libnet_rpc.c
@@ -189,11 +189,11 @@ static NTSTATUS libnet_RpcConnectSrv_recv(struct composite_context *c,
 					  struct libnet_RpcConnect *r)
 {
 	NTSTATUS status;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list