From 7c946bfafe961c1dda51d19b5c29a5600ef1e5ec Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sun, 26 Jul 2015 08:29:05 -0600 Subject: * Fix compilation error in arg.c when pwdcertdir was being freed, even though a password file might have not been defined. * Work on reducing the number of warnings in OSX. --- imap/src/osdep/unix/ckp_pam.c | 4 ++-- imap/src/osdep/unix/ssl_unix.c | 16 ++++++++-------- imap/src/osdep/unix/unix.c | 13 +++++++------ 3 files changed, 17 insertions(+), 16 deletions(-) (limited to 'imap/src/osdep') diff --git a/imap/src/osdep/unix/ckp_pam.c b/imap/src/osdep/unix/ckp_pam.c index 60c6c1f7..5bc31f3d 100644 --- a/imap/src/osdep/unix/ckp_pam.c +++ b/imap/src/osdep/unix/ckp_pam.c @@ -104,13 +104,13 @@ struct passwd *checkpw (struct passwd *pw,char *pass,int argc,char *argv[]) conv.appdata_ptr = &cred; cred.uname = name; cred.pass = pass; - if (pw = ((pam_start ((char *) mail_parameters (NIL,GET_SERVICENAME,NIL), + if ((pw = ((pam_start ((char *) mail_parameters (NIL,GET_SERVICENAME,NIL), pw->pw_name,&conv,&hdl) == PAM_SUCCESS) && (pam_set_item (hdl,PAM_RHOST,tcp_clientaddr ()) == PAM_SUCCESS) && (pam_authenticate (hdl,NIL) == PAM_SUCCESS) && (pam_acct_mgmt (hdl,NIL) == PAM_SUCCESS) && (pam_setcred (hdl,PAM_ESTABLISH_CRED) == PAM_SUCCESS)) ? - getpwnam (name) : NIL) { + getpwnam (name) : NIL) != NULL) { #if 0 /* * Some people have reported that this causes a SEGV in strncpy() from diff --git a/imap/src/osdep/unix/ssl_unix.c b/imap/src/osdep/unix/ssl_unix.c index d77ed719..16b4228c 100644 --- a/imap/src/osdep/unix/ssl_unix.c +++ b/imap/src/osdep/unix/ssl_unix.c @@ -261,11 +261,11 @@ static char *ssl_start_work (SSLSTREAM *stream,char *host,unsigned long flags) /* set default paths to CAs... */ SSL_CTX_set_default_verify_paths (stream->context); /* ...unless a non-standard path desired */ - if (s = (char *) mail_parameters (NIL,GET_SSLCAPATH,NIL)) + if ((s = (char *) mail_parameters (NIL,GET_SSLCAPATH,NIL)) != NULL) SSL_CTX_load_verify_locations (stream->context,NIL,s); /* want to send client certificate? */ if (scc && (s = (*scc) ()) && (sl = strlen (s))) { - if (cert = PEM_read_bio_X509 (bio = BIO_new_mem_buf (s,sl),NIL,NIL,NIL)) { + if ((cert = PEM_read_bio_X509 (bio = BIO_new_mem_buf (s,sl),NIL,NIL,NIL)) != NULL) { SSL_CTX_use_certificate (stream->context,cert); X509_free (cert); } @@ -274,8 +274,8 @@ static char *ssl_start_work (SSLSTREAM *stream,char *host,unsigned long flags) /* want to supply private key? */ if ((t = (sck ? (*sck) () : s)) && (tl = strlen (t))) { EVP_PKEY *key; - if (key = PEM_read_bio_PrivateKey (bio = BIO_new_mem_buf (t,tl), - NIL,NIL,"")) { + if ((key = PEM_read_bio_PrivateKey (bio = BIO_new_mem_buf (t,tl), + NIL,NIL,"")) != NULL) { SSL_CTX_use_PrivateKey (stream->context,key); EVP_PKEY_free (key); } @@ -354,8 +354,8 @@ static char *ssl_validate_cert (X509 *cert,char *host) /* and that it has a name */ else if (!cert->name) ret = "No name in certificate"; /* locate CN */ - else if (s = strstr (cert->name,"/CN=")) { - if (t = strchr (s += 4,'/')) *t = '\0'; + else if ((s = strstr (cert->name,"/CN=")) != NULL) { + if ((t = strchr (s += 4,'/')) != NULL) *t = '\0'; /* host name matches pattern? */ ret = ssl_compare_hostnames (host,s) ? NIL : "Server name does not match certificate"; @@ -785,7 +785,7 @@ void ssl_server_init (char *server) } } } - while (i = ERR_get_error ()) /* SSL failure */ + while ((i = ERR_get_error ()) != 0L) /* SSL failure */ syslog (LOG_ERR,"SSL error status: %.80s",ERR_error_string (i,NIL)); ssl_close (stream); /* punt stream */ exit (1); /* punt this program too */ @@ -807,7 +807,7 @@ static RSA *ssl_genkey (SSL *con,int export,int keylength) if (!(key = RSA_generate_key (export ? keylength : 1024,RSA_F4,NIL,NIL))) { syslog (LOG_ALERT,"Unable to generate temp key, host=%.80s", tcp_clienthost ()); - while (i = ERR_get_error ()) + while ((i = ERR_get_error ()) != 0L) syslog (LOG_ALERT,"SSL error status: %s",ERR_error_string (i,NIL)); exit (1); } diff --git a/imap/src/osdep/unix/unix.c b/imap/src/osdep/unix/unix.c index 8bca508c..cda5798c 100644 --- a/imap/src/osdep/unix/unix.c +++ b/imap/src/osdep/unix/unix.c @@ -398,15 +398,16 @@ long unix_rename (MAILSTREAM *stream,char *old,char *newname) MM_CRITICAL (stream); /* get the c-client lock */ if (!dummy_file (file,old) || (newname && (!((s = mailboxfile (tmp,newname)) && *s) || - ((s = strrchr (tmp,'/')) && !s[1])))) - sprintf (tmp,newname ? - "Can't rename mailbox %.80s to %.80s: invalid name" : - "Can't delete mailbox %.80s: invalid name", + ((s = strrchr (tmp,'/')) && !s[1])))){ + if(newname) + sprintf (tmp, "Can't rename mailbox %.80s to %.80s: invalid name", old,newname); + else + sprintf (tmp, "Can't delete mailbox %.80s: invalid name",old); /* lock out other c-clients */ - else if ((ld = lockname (lock,file,LOCK_EX|LOCK_NB,&i)) < 0) + } else if ((ld = lockname (lock,file,LOCK_EX|LOCK_NB,&i)) < 0) sprintf (tmp,"Mailbox %.80s is in use by another process",old); - + else { if ((fd = unix_lock (file,O_RDWR, (long) mail_parameters (NIL,GET_MBXPROTECTION,NIL), -- cgit v1.2.3-54-g00ecf