diff --git a/configure.in b/configure.in index f7f1a23..b028985 100644 --- a/configure.in +++ b/configure.in @@ -129,7 +129,7 @@ if test "$enable_staticdlopen" = yes; then fi if test "$ac_cv_prog_gcc" = yes; then - CFLAGS="-Wall -W ${CFLAGS}" + CFLAGS="-Wall -W -Wno-unused ${CFLAGS}" fi AC_ARG_WITH(purecov,[ --with-purecov link with purecov]) diff --git a/include/sasl.h b/include/sasl.h index dfc4d6a..4ee816a 100755 --- a/include/sasl.h +++ b/include/sasl.h @@ -130,6 +130,7 @@ #define SASL_VERSION_FULL ((SASL_VERSION_MAJOR << 16) |\ (SASL_VERSION_MINOR << 8) | SASL_VERSION_STEP) +#include #include "prop.h" /************* @@ -223,9 +224,9 @@ extern "C" { /* memory allocation functions which may optionally be replaced: */ -typedef void *sasl_malloc_t(unsigned long); -typedef void *sasl_calloc_t(unsigned long, unsigned long); -typedef void *sasl_realloc_t(void *, unsigned long); +typedef void *sasl_malloc_t(size_t); +typedef void *sasl_calloc_t(size_t, size_t); +typedef void *sasl_realloc_t(void *, size_t); typedef void sasl_free_t(void *); LIBSASL_API void sasl_set_alloc(sasl_malloc_t *, diff --git a/lib/common.c b/lib/common.c index b76df23..5731d1e 100644 --- a/lib/common.c +++ b/lib/common.c @@ -386,7 +386,7 @@ _sasl_encodev (sasl_conn_t *conn, conn->multipacket_encoded_data.curlen += *outputlen; *output = conn->multipacket_encoded_data.data; - *outputlen = conn->multipacket_encoded_data.curlen; + *outputlen = (unsigned) conn->multipacket_encoded_data.curlen; } (*p_num_packets)++; @@ -454,7 +454,7 @@ int sasl_encodev(sasl_conn_t *conn, /* Fit as many bytes in last_invec, so that we have conn->oparams.maxoutbuf bytes in total. */ - last_invec.iov_len = conn->oparams.maxoutbuf - total_size; + last_invec.iov_len = (long) (conn->oparams.maxoutbuf - total_size); /* Point to the first byte of the current record. */ last_invec.iov_base = invec[i].iov_base; @@ -520,7 +520,7 @@ int sasl_encodev(sasl_conn_t *conn, next_buf = (char *) last_invec.iov_base + last_invec.iov_len; /* Note - remainder_len is how many bytes left to be encoded in the current IOV slot. */ - remainder_len = (total_size + invec[i].iov_len) - conn->oparams.maxoutbuf; + remainder_len = (unsigned) ((total_size + invec[i].iov_len) - conn->oparams.maxoutbuf); /* Skip all consumed IOV records */ invec += i + 1; diff --git a/lib/server.c b/lib/server.c index 4bd987c..04422cc 100644 --- a/lib/server.c +++ b/lib/server.c @@ -621,7 +621,7 @@ static int load_config(const sasl_callback_t *verifyfile_cb) goto done; } - snprintf(config_filename, len, "%.*s%c%s.conf", path_len, path_to_config, + snprintf(config_filename, len, "%.*s%c%s.conf", (int) path_len, path_to_config, HIER_DELIMITER, global_callbacks.appname); /* Ask the application if it's safe to use this file */ diff --git a/plugins/ntlm.c b/plugins/ntlm.c index 5188d69..828eb9b 100644 --- a/plugins/ntlm.c +++ b/plugins/ntlm.c @@ -57,6 +57,7 @@ #ifdef WIN32 # include /* for getpid */ typedef int pid_t; +# define getpid _getpid #else # include # include @@ -275,7 +276,7 @@ static void load_buffer(u_char *buf, const u_char *str, uint16 len, { if (len) { if (unicode) { - to_unicode(base + *offset, str, len); + to_unicode(base + *offset, (char *) str, len); len *= 2; } else { @@ -373,10 +374,10 @@ static unsigned char *P16_lm(unsigned char *P16, sasl_secret_t *passwd, char P14[14]; unsigned char S8[] = { 0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 }; - strncpy(P14, passwd->data, sizeof(P14)); + strncpy(P14, (char *) passwd->data, sizeof(P14)); ucase(P14, sizeof(P14)); - E(P16, P14, sizeof(P14), S8, sizeof(S8)); + E(P16, (unsigned char *) P14, sizeof(P14), S8, sizeof(S8)); *result = SASL_OK; return P16; } @@ -390,8 +391,8 @@ static unsigned char *P16_nt(unsigned char *P16, sasl_secret_t *passwd, *result = SASL_NOMEM; } else { - to_unicode(*buf, passwd->data, passwd->len); - MD4(*buf, 2 * passwd->len, P16); + to_unicode(*(unsigned char **) buf, (char *) passwd->data, passwd->len); + MD4(*(unsigned char **) buf, 2 * passwd->len, P16); *result = SASL_OK; } return P16; @@ -444,9 +445,9 @@ static unsigned char *V2(unsigned char *V2, sasl_secret_t *passwd, strcpy(upper, authid); if (target) strcat(upper, target); ucase(upper, len); - to_unicode(*buf, upper, len); + to_unicode(*(unsigned char **) buf, upper, len); - HMAC(EVP_md5(), hash, MD4_DIGEST_LENGTH, *buf, 2 * len, hash, &len); + HMAC(EVP_md5(), hash, MD4_DIGEST_LENGTH, *(unsigned char **) buf, 2 * len, hash, &len); /* V2 = HMAC-MD5(NTLMv2hash, challenge + blob) + blob */ HMAC_Init(&ctx, hash, len, EVP_md5()); @@ -768,8 +769,8 @@ static void make_netbios_name(const char *in, unsigned char out[]) */ n = strcspn(in, "."); if (n > 16) n = 16; - strncpy(out+18, in, n); - in = out+18; + strncpy((char *) out+18, in, n); + in = (char *) out+18; ucase(in, n); out[j++] = 0x20; @@ -831,7 +832,7 @@ static SOCKET smb_connect_server(const sasl_utils_t *utils, const char *client, s = socket(r->ai_family, r->ai_socktype, r->ai_protocol); if (s < 0) continue; - if (connect(s, r->ai_addr, r->ai_addrlen) >= 0) + if (connect(s, r->ai_addr, (int) r->ai_addrlen) >= 0) break; #ifdef WIN32 saved_errno = WSAGetLastError(); @@ -845,7 +846,7 @@ static SOCKET smb_connect_server(const sasl_utils_t *utils, const char *client, if (r->ai_family == AF_INET6) niflags |= NI_WITHSCOPEID; #endif - if (getnameinfo(r->ai_addr, r->ai_addrlen, hbuf, sizeof(hbuf), + if (getnameinfo(r->ai_addr, (socklen_t) r->ai_addrlen, hbuf, sizeof(hbuf), pbuf, sizeof(pbuf), niflags) != 0) { strcpy(hbuf, "unknown"); strcpy(pbuf, "unknown"); @@ -862,7 +863,7 @@ static SOCKET smb_connect_server(const sasl_utils_t *utils, const char *client, utils->free (error_str); } if (s < 0) { - if (getnameinfo(ai->ai_addr, ai->ai_addrlen, NULL, 0, + if (getnameinfo(ai->ai_addr, (socklen_t) ai->ai_addrlen, NULL, 0, pbuf, sizeof(pbuf), NI_NUMERICSERV) != 0) { strcpy(pbuf, "unknown"); } @@ -1033,7 +1034,7 @@ static int smb_negotiate_protocol(const sasl_utils_t *utils, "NTLM: error reading NEGPROT response"); return SASL_FAIL; } - p = text->out_buf; + p = (unsigned char *) text->out_buf; /* parse the header */ if (len < SMB_HDR_SIZE) { @@ -1115,7 +1116,7 @@ static int smb_negotiate_protocol(const sasl_utils_t *utils, return SASL_NOMEM; } memcpy(*domain, p, len); - from_unicode(*domain, *domain, len); + from_unicode(*domain, *(unsigned char **) domain, len); text->flags |= NTLM_TARGET_IS_DOMAIN; } @@ -1256,7 +1257,7 @@ static int smb_session_setup(const sasl_utils_t *utils, server_context_t *text, "NTLM: error reading SESSIONSETUP response"); return SASL_FAIL; } - p = text->out_buf; + p = (unsigned char *) text->out_buf; /* parse the header */ if (len < SMB_HDR_SIZE) { @@ -1343,12 +1344,12 @@ static int create_challenge(const sasl_utils_t *utils, return SASL_NOMEM; } - base = *buf; + base = *(u_char **) buf; memset(base, 0, *outlen); memcpy(base + NTLM_SIG_OFFSET, NTLM_SIGNATURE, sizeof(NTLM_SIGNATURE)); htoil(base + NTLM_TYPE_OFFSET, NTLM_TYPE_CHALLENGE); load_buffer(base + NTLM_TYPE2_TARGET_OFFSET, - ucase(target, 0), (uint16) xstrlen(target), flags & NTLM_USE_UNICODE, + (u_char *) ucase(target, 0), (uint16) xstrlen(target), flags & NTLM_USE_UNICODE, base, &offset); htoil(base + NTLM_TYPE2_FLAGS_OFFSET, flags); memcpy(base + NTLM_TYPE2_CHALLENGE_OFFSET, nonce, NTLM_NONCE_LENGTH); @@ -1500,26 +1501,26 @@ static int ntlm_server_mech_step2(server_context_t *text, return SASL_BADPROT; } - result = unload_buffer(sparams->utils, clientin + NTLM_TYPE3_LMRESP_OFFSET, + result = unload_buffer(sparams->utils, (u_char *) clientin + NTLM_TYPE3_LMRESP_OFFSET, (u_char **) &lm_resp, &lm_resp_len, 0, - clientin, clientinlen); + (u_char *) clientin, clientinlen); if (result != SASL_OK) goto cleanup; - result = unload_buffer(sparams->utils, clientin + NTLM_TYPE3_NTRESP_OFFSET, + result = unload_buffer(sparams->utils, (u_char *) clientin + NTLM_TYPE3_NTRESP_OFFSET, (u_char **) &nt_resp, &nt_resp_len, 0, - clientin, clientinlen); + (u_char *) clientin, clientinlen); if (result != SASL_OK) goto cleanup; - result = unload_buffer(sparams->utils, clientin + NTLM_TYPE3_DOMAIN_OFFSET, + result = unload_buffer(sparams->utils, (u_char *) clientin + NTLM_TYPE3_DOMAIN_OFFSET, (u_char **) &domain, &domain_len, text->flags & NTLM_USE_UNICODE, - clientin, clientinlen); + (u_char *) clientin, clientinlen); if (result != SASL_OK) goto cleanup; - result = unload_buffer(sparams->utils, clientin + NTLM_TYPE3_USER_OFFSET, + result = unload_buffer(sparams->utils, (u_char *) clientin + NTLM_TYPE3_USER_OFFSET, (u_char **) &authid, &authid_len, text->flags & NTLM_USE_UNICODE, - clientin, clientinlen); + (u_char *) clientin, clientinlen); if (result != SASL_OK) goto cleanup; /* require at least one response and an authid */ @@ -1582,7 +1583,7 @@ static int ntlm_server_mech_step2(server_context_t *text, } password->len = (unsigned) pass_len; - strncpy(password->data, auxprop_values[0].values[0], pass_len + 1); + strncpy((char *) password->data, auxprop_values[0].values[0], pass_len + 1); /* erase the plaintext password */ sparams->utils->prop_erase(sparams->propctx, password_request[0]); @@ -1800,15 +1801,15 @@ static int create_request(const sasl_utils_t *utils, return SASL_NOMEM; } - base = *buf; + base = *(u_char **) buf; memset(base, 0, *outlen); memcpy(base + NTLM_SIG_OFFSET, NTLM_SIGNATURE, sizeof(NTLM_SIGNATURE)); htoil(base + NTLM_TYPE_OFFSET, NTLM_TYPE_REQUEST); htoil(base + NTLM_TYPE1_FLAGS_OFFSET, flags); load_buffer(base + NTLM_TYPE1_DOMAIN_OFFSET, - domain, (uint16) xstrlen(domain), 0, base, &offset); + (u_char *) domain, (uint16) xstrlen(domain), 0, base, &offset); load_buffer(base + NTLM_TYPE1_WORKSTN_OFFSET, - wkstn, (uint16) xstrlen(wkstn), 0, base, &offset); + (u_char *) wkstn, (uint16) xstrlen(wkstn), 0, base, &offset); return SASL_OK; } @@ -1853,7 +1854,7 @@ static int create_response(const sasl_utils_t *utils, return SASL_NOMEM; } - base = *buf; + base = *(u_char **) buf; memset(base, 0, *outlen); memcpy(base + NTLM_SIG_OFFSET, NTLM_SIGNATURE, sizeof(NTLM_SIGNATURE)); htoil(base + NTLM_TYPE_OFFSET, NTLM_TYPE_RESPONSE); @@ -1862,15 +1863,15 @@ static int create_response(const sasl_utils_t *utils, load_buffer(base + NTLM_TYPE3_NTRESP_OFFSET, nt_resp, nt_resp ? NTLM_RESP_LENGTH : 0, 0, base, &offset); load_buffer(base + NTLM_TYPE3_DOMAIN_OFFSET, - ucase(domain, 0), (uint16) xstrlen(domain), flags & NTLM_USE_UNICODE, + (u_char *) ucase(domain, 0), (uint16) xstrlen(domain), flags & NTLM_USE_UNICODE, base, &offset); load_buffer(base + NTLM_TYPE3_USER_OFFSET, - user, (uint16) xstrlen(user), flags & NTLM_USE_UNICODE, base, &offset); + (u_char *) user, (uint16) xstrlen(user), flags & NTLM_USE_UNICODE, base, &offset); load_buffer(base + NTLM_TYPE3_WORKSTN_OFFSET, - ucase(wkstn, 0), (uint16) xstrlen(wkstn), flags & NTLM_USE_UNICODE, + (u_char *) ucase(wkstn, 0), (uint16) xstrlen(wkstn), flags & NTLM_USE_UNICODE, base, &offset); load_buffer(base + NTLM_TYPE3_SESSIONKEY_OFFSET, - key, key ? NTLM_SESSKEY_LENGTH : 0, 0, base, &offset); + (u_char *) key, key ? NTLM_SESSKEY_LENGTH : 0, 0, base, &offset); htoil(base + NTLM_TYPE3_FLAGS_OFFSET, flags); return SASL_OK; @@ -2006,7 +2007,7 @@ static int ntlm_client_mech_step2(client_context_t *text, flags &= NTLM_FLAGS_MASK; /* mask off the bits we don't support */ - result = unload_buffer(params->utils, serverin + NTLM_TYPE2_TARGET_OFFSET, + result = unload_buffer(params->utils, (u_char *) serverin + NTLM_TYPE2_TARGET_OFFSET, (u_char **) &domain, NULL, flags & NTLM_USE_UNICODE, (u_char *) serverin, serverinlen); @@ -2022,7 +2023,7 @@ static int ntlm_client_mech_step2(client_context_t *text, (*sendv2 == 'o' && *sendv2 == 'n') || *sendv2 == 't')) { /* put the cnonce in place after the LMv2 HMAC */ - char *cnonce = resp + MD5_DIGEST_LENGTH; + char *cnonce = (char *) resp + MD5_DIGEST_LENGTH; params->utils->log(NULL, SASL_LOG_DEBUG, "calculating LMv2 response"); @@ -2030,7 +2031,7 @@ static int ntlm_client_mech_step2(client_context_t *text, params->utils->rand(params->utils->rpool, cnonce, NTLM_NONCE_LENGTH); V2(resp, password, oparams->authid, domain, - serverin + NTLM_TYPE2_CHALLENGE_OFFSET, cnonce, NTLM_NONCE_LENGTH, + (u_char *) serverin + NTLM_TYPE2_CHALLENGE_OFFSET, (u_char *) cnonce, NTLM_NONCE_LENGTH, params->utils, &text->out_buf, &text->out_buf_len, &result); lm_resp = resp; diff --git a/plugins/plugin_common.c b/plugins/plugin_common.c index 45d83e9..aaaca4a 100644 --- a/plugins/plugin_common.c +++ b/plugins/plugin_common.c @@ -152,7 +152,7 @@ int _plug_ipfromstring(const sasl_utils_t *utils, const char *addr, return SASL_BADPARAM; } - len = ai->ai_addrlen; + len = (socklen_t) ai->ai_addrlen; memcpy(&ss, ai->ai_addr, len); freeaddrinfo(ai); sockaddr_unmapped((struct sockaddr *)&ss, &len); @@ -230,7 +230,7 @@ int _plug_buf_alloc(const sasl_utils_t *utils, char **rwbuf, } *curlen = newlen; } else if(*rwbuf && *curlen < newlen) { - size_t needed = 2*(*curlen); + unsigned needed = 2*(*curlen); while(needed < newlen) needed *= 2; @@ -251,7 +251,7 @@ int _plug_buf_alloc(const sasl_utils_t *utils, char **rwbuf, int _plug_strdup(const sasl_utils_t * utils, const char *in, char **out, int *outlen) { - size_t len = strlen(in); + int len = (int) strlen(in); if(!utils || !in || !out) { if(utils) PARAMERROR(utils); @@ -280,7 +280,7 @@ void _plug_free_string(const sasl_utils_t *utils, char **str) len = strlen(*str); - utils->erasebuffer(*str, len); + utils->erasebuffer(*str, (unsigned) len); utils->free(*str); *str=NULL; diff --git a/plugins/sasldb.c b/plugins/sasldb.c index 1edbb8b..e4b5e7c 100644 --- a/plugins/sasldb.c +++ b/plugins/sasldb.c @@ -248,7 +248,7 @@ static int sasldb_auxprop_store(void *glob_context __attribute__((unused)), ret = SASL_OK; for (cur = to_store; cur->name; cur++) { - char * value = (cur->values && cur->values[0]) ? cur->values[0] : NULL; + const char * value = (cur->values && cur->values[0]) ? cur->values[0] : NULL; if (cur->name[0] == '*') { continue; diff --git a/sample/client.c b/sample/client.c index 0ddb16c..6db16df 100644 --- a/sample/client.c +++ b/sample/client.c @@ -169,7 +169,7 @@ getsecret(sasl_conn_t *conn, } x->len = len; - strcpy(x->data, password); + strcpy((char *) x->data, password); memset(password, 0, len); *psecret = x; @@ -232,7 +232,7 @@ int mysasl_negotiate(FILE *in, FILE *out, sasl_conn_t *conn) char buf[8192]; const char *data; const char *chosenmech; - int len; + unsigned int len; int r, c; /* get the capability list */ @@ -334,7 +334,7 @@ int main(int argc, char *argv[]) sasl_conn_t *conn; FILE *in, *out; int fd; - int salen; + unsigned int salen; int niflags, error; struct sockaddr_storage local_ip, remote_ip; diff --git a/sample/sample-client.c b/sample/sample-client.c index 7a962a6..8c9fca1 100644 --- a/sample/sample-client.c +++ b/sample/sample-client.c @@ -41,6 +41,9 @@ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#define _XOPEN_SOURCE 500 + #include #include #include @@ -50,7 +53,8 @@ # include __declspec(dllimport) char *optarg; __declspec(dllimport) int optind; -__declspec(dllimport) int getsubopt(char **optionp, const char * const *tokens, char **valuep); +__declspec(dllimport) int getsubopt(char **optionp, char * const *tokens, char **valuep); +#define HAVE_GETSUBOPT #else /* WIN32 */ # include #endif /* WIN32 */ @@ -83,7 +87,7 @@ int main(void) #endif #ifndef HAVE_GETSUBOPT -int getsubopt(char **optionp, const char * const *tokens, char **valuep); +int getsubopt(char **optionp, char * const *tokens, char **valuep); #endif static const char @@ -403,7 +407,7 @@ samp_recv() fail("Line must start with 'S: '"); } - len = strlen(buf); + len = (unsigned) strlen(buf); if (len > 0 && buf[len-1] == '\n') { buf[len-1] = '\0'; } @@ -475,7 +479,7 @@ main(int argc, char *argv[]) case 'b': options = optarg; while (*options != '\0') - switch(getsubopt(&options, (const char * const *)bit_subopts, &value)) { + switch(getsubopt(&options, (char * const *)bit_subopts, &value)) { case OPT_MIN: if (! value) errflag = 1; @@ -505,7 +509,7 @@ main(int argc, char *argv[]) case 'e': options = optarg; while (*options != '\0') - switch(getsubopt(&options, (const char * const *)ext_subopts, &value)) { + switch(getsubopt(&options, (char * const *)ext_subopts, &value)) { case OPT_EXT_SSF: if (! value) errflag = 1; @@ -531,7 +535,7 @@ main(int argc, char *argv[]) case 'f': options = optarg; while (*options != '\0') { - switch(getsubopt(&options, (const char * const *)flag_subopts, &value)) { + switch(getsubopt(&options, (char * const *)flag_subopts, &value)) { case OPT_NOPLAIN: secprops.security_flags |= SASL_SEC_NOPLAINTEXT; break; @@ -561,7 +565,7 @@ main(int argc, char *argv[]) case 'i': options = optarg; while (*options != '\0') - switch(getsubopt(&options, (const char * const *)ip_subopts, &value)) { + switch(getsubopt(&options, (char * const *)ip_subopts, &value)) { case OPT_IP_LOCAL: if (! value) errflag = 1; diff --git a/sample/sample-server.c b/sample/sample-server.c index db13d55..fd44c2e 100644 --- a/sample/sample-server.c +++ b/sample/sample-server.c @@ -42,6 +42,8 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#define _XOPEN_SOURCE 500 + #include #include #include @@ -57,16 +59,17 @@ # include __declspec(dllimport) char *optarg; __declspec(dllimport) int optind; -__declspec(dllimport) int getsubopt(char **optionp, const char * const *tokens, char **valuep); +__declspec(dllimport) int getsubopt(char **optionp, char * const *tokens, char **valuep); #define HAVE_GETSUBOPT #else /* WIN32 */ # include +# include #endif /* WIN32 */ #include #include #ifndef HAVE_GETSUBOPT -int getsubopt(char **optionp, const char * const *tokens, char **valuep); +int getsubopt(char **optionp, char * const *tokens, char **valuep); #endif static const char @@ -262,7 +265,7 @@ samp_recv() fail("Line must start with 'C: '"); } - len = strlen(buf); + len = (unsigned) strlen(buf); if (len > 0 && buf[len-1] == '\n') { buf[len-1] = '\0'; } @@ -287,7 +290,8 @@ main(int argc, char *argv[]) sasl_ssf_t extssf = 0; const char *ext_authid = NULL; char *options, *value; - unsigned len, count; + unsigned len; + int count; const char *data; int serverlast = 0; sasl_ssf_t *ssf; @@ -322,7 +326,7 @@ main(int argc, char *argv[]) case 'b': options = optarg; while (*options != '\0') - switch(getsubopt(&options, (const char * const *)bit_subopts, &value)) { + switch(getsubopt(&options, (char * const *)bit_subopts, &value)) { case OPT_MIN: if (! value) errflag = 1; @@ -344,7 +348,7 @@ main(int argc, char *argv[]) case 'e': options = optarg; while (*options != '\0') - switch(getsubopt(&options, (const char * const *)ext_subopts, &value)) { + switch(getsubopt(&options, (char * const *)ext_subopts, &value)) { case OPT_EXT_SSF: if (! value) errflag = 1; @@ -370,7 +374,7 @@ main(int argc, char *argv[]) case 'f': options = optarg; while (*options != '\0') { - switch(getsubopt(&options, (const char * const *)flag_subopts, &value)) { + switch(getsubopt(&options, (char * const *)flag_subopts, &value)) { case OPT_NOPLAIN: secprops.security_flags |= SASL_SEC_NOPLAINTEXT; break; @@ -404,7 +408,7 @@ main(int argc, char *argv[]) case 'i': options = optarg; while (*options != '\0') - switch(getsubopt(&options, (const char * const *)ip_subopts, &value)) { + switch(getsubopt(&options, (char * const *)ip_subopts, &value)) { case OPT_IP_LOCAL: if (! value) errflag = 1; diff --git a/sample/server.c b/sample/server.c index e0af99c..00822e0 100644 --- a/sample/server.c +++ b/sample/server.c @@ -181,7 +181,7 @@ int mysasl_negotiate(FILE *in, FILE *out, sasl_conn_t *conn) dprintf(1, "generating client mechanism list... "); r = sasl_listmech(conn, NULL, NULL, " ", NULL, - &data, &len, &count); + &data, (unsigned *) &len, &count); if (r != SASL_OK) saslfail(r, "generating mechanism list"); dprintf(1, "%d mechanisms\n", count); } @@ -219,10 +219,10 @@ int mysasl_negotiate(FILE *in, FILE *out, sasl_conn_t *conn) /* start libsasl negotiation */ r = sasl_server_start(conn, chosenmech, buf, len, - &data, &len); + &data, (unsigned *) &len); } else { r = sasl_server_start(conn, chosenmech, NULL, 0, - &data, &len); + &data, (unsigned *) &len); } if (r != SASL_OK && r != SASL_CONTINUE) { @@ -250,7 +250,7 @@ int mysasl_negotiate(FILE *in, FILE *out, sasl_conn_t *conn) return -1; } - r = sasl_server_step(conn, buf, len, &data, &len); + r = sasl_server_step(conn, buf, len, &data, (unsigned *) &len); if (r != SASL_OK && r != SASL_CONTINUE) { saslerr(r, "performing SASL negotiation"); fputc('N', out); /* send NO to client */ @@ -326,7 +326,7 @@ int main(int argc, char *argv[]) char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; struct sockaddr_storage local_ip, remote_ip; int niflags, error; - int salen; + socklen_t salen; int nfds, fd = -1; FILE *in, *out; fd_set readfds; diff --git a/saslauthd/auth_pam.c b/saslauthd/auth_pam.c index 5af938f..f0f1906 100644 --- a/saslauthd/auth_pam.c +++ b/saslauthd/auth_pam.c @@ -43,13 +43,14 @@ */ /* PUBLIC DEPENDENCIES */ -#include "mechanisms.h" -#include - #ifdef HAVE_CONFIG_H #include +#undef PACKAGE #endif +#include "mechanisms.h" +#include + #ifdef AUTH_PAM # include diff --git a/saslauthd/auth_sasldb.c b/saslauthd/auth_sasldb.c index 720d339..862e698 100644 --- a/saslauthd/auth_sasldb.c +++ b/saslauthd/auth_sasldb.c @@ -36,12 +36,15 @@ #endif /* PUBLIC DEPENDENCIES */ +#ifdef HAVE_CONFIG_H +#include +#undef PACKAGE +#endif #include "mechanisms.h" #include #include #include -#include /* END PUBLIC DEPENDENCIES */ #define RETURN(x) return strdup(x) diff --git a/saslauthd/md5.c b/saslauthd/md5.c index d38425d..1f8b8ac 100644 --- a/saslauthd/md5.c +++ b/saslauthd/md5.c @@ -25,7 +25,10 @@ These notices must be retained in any copies of any part of this documentation and/or software. */ +#ifdef HAVE_CONFIG_H #include +#endif + #include "md5global.h" #include "md5.h" #include "hmac-md5.h" diff --git a/utils/pluginviewer.c b/utils/pluginviewer.c index a8c3bae..e090109 100644 --- a/utils/pluginviewer.c +++ b/utils/pluginviewer.c @@ -42,6 +42,9 @@ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#define _XOPEN_SOURCE 500 + #include #include #include @@ -51,9 +54,11 @@ # include __declspec(dllimport) char *optarg; __declspec(dllimport) int optind; -__declspec(dllimport) int getsubopt(char **optionp, const char * const *tokens, char **valuep); +__declspec(dllimport) int getsubopt(char **optionp, char * const *tokens, char **valuep); +#define HAVE_GETSUBOPT #else /* WIN32 */ # include +# include #endif /* WIN32 */ #include #include @@ -234,7 +239,7 @@ sasl_getopt ( if (len != NULL) { /* This might be NULL, which means "all mechanisms" */ - *len = sasl_mech ? strlen(sasl_mech) : 0; + *len = sasl_mech ? (unsigned) strlen(sasl_mech) : 0; } return (SASL_OK); } @@ -379,7 +384,7 @@ main(int argc, char *argv[]) char *options, *value; const char *available_mechs = NULL; unsigned len; - unsigned count; + int count; sasl_callback_t callbacks[N_CALLBACKS], *callback; char *searchpath = NULL; char *service = "test"; @@ -437,7 +442,7 @@ main(int argc, char *argv[]) case 'b': options = optarg; while (*options != '\0') { - switch(getsubopt(&options, (const char * const *)bit_subopts, &value)) { + switch(getsubopt(&options, (char * const *)bit_subopts, &value)) { case OPT_MIN: if (! value) { errflag = 1; @@ -462,7 +467,7 @@ main(int argc, char *argv[]) case 'e': options = optarg; while (*options != '\0') { - switch(getsubopt(&options, (const char * const *)ext_subopts, &value)) { + switch(getsubopt(&options, (char * const *)ext_subopts, &value)) { case OPT_EXT_SSF: if (! value) { errflag = 1; @@ -491,7 +496,7 @@ main(int argc, char *argv[]) case 'f': options = optarg; while (*options != '\0') { - switch(getsubopt(&options, (const char * const *)flag_subopts, &value)) { + switch(getsubopt(&options, (char * const *)flag_subopts, &value)) { case OPT_NOPLAIN: secprops.security_flags |= SASL_SEC_NOPLAINTEXT; break;