From 0146e3ddfce7ac51fa380f8ba67fefaf922f0ce8 Mon Sep 17 00:00:00 2001 From: Ryan Tandy Date: Mon, 23 Mar 2015 18:57:39 -0700 Subject: [PATCH] ITS#8097 nssov: clean up some compiler warnings --- contrib/slapd-modules/nssov/ether.c | 2 +- contrib/slapd-modules/nssov/host.c | 2 +- contrib/slapd-modules/nssov/network.c | 2 +- contrib/slapd-modules/nssov/nssov.c | 15 +++++++++------ contrib/slapd-modules/nssov/nssov.h | 4 +++- contrib/slapd-modules/nssov/pam.c | 3 +++ contrib/slapd-modules/nssov/passwd.c | 1 - contrib/slapd-modules/nssov/protocol.c | 4 ++-- contrib/slapd-modules/nssov/rpc.c | 2 +- contrib/slapd-modules/nssov/service.c | 4 ++-- 10 files changed, 23 insertions(+), 16 deletions(-) diff --git a/contrib/slapd-modules/nssov/ether.c b/contrib/slapd-modules/nssov/ether.c index 0cb85db830..e2a6a50a6d 100644 --- a/contrib/slapd-modules/nssov/ether.c +++ b/contrib/slapd-modules/nssov/ether.c @@ -65,7 +65,7 @@ static int write_ether(nssov_ether_cbp *cbp,Entry *entry) { int32_t tmpint32; struct ether_addr tmpaddr; - struct berval tmparr[2], empty; + struct berval tmparr[2]; struct berval *names,*ethers; Attribute *a; int i,j; diff --git a/contrib/slapd-modules/nssov/host.c b/contrib/slapd-modules/nssov/host.c index 4fae49d4c5..76d7029d64 100644 --- a/contrib/slapd-modules/nssov/host.c +++ b/contrib/slapd-modules/nssov/host.c @@ -50,7 +50,7 @@ NSSOV_CBPRIV(host, /* write a single host entry to the stream */ static int write_host(nssov_host_cbp *cbp,Entry *entry) { - int32_t tmpint32,tmp2int32,tmp3int32; + int32_t tmpint32; int numaddr,i,numname,dupname; struct berval name,*names,*addrs; Attribute *a; diff --git a/contrib/slapd-modules/nssov/network.c b/contrib/slapd-modules/nssov/network.c index 272dfda4c7..6387688ed9 100644 --- a/contrib/slapd-modules/nssov/network.c +++ b/contrib/slapd-modules/nssov/network.c @@ -50,7 +50,7 @@ NSSOV_CBPRIV(network, /* write a single network entry to the stream */ static int write_network(nssov_network_cbp *cbp,Entry *entry) { - int32_t tmpint32,tmp2int32,tmp3int32; + int32_t tmpint32; int numaddr,i,numname,dupname; struct berval name, *names, *addrs; Attribute *a; diff --git a/contrib/slapd-modules/nssov/nssov.c b/contrib/slapd-modules/nssov/nssov.c index e55c0c351f..e361d7d3d7 100644 --- a/contrib/slapd-modules/nssov/nssov.c +++ b/contrib/slapd-modules/nssov/nssov.c @@ -46,7 +46,7 @@ AttributeDescription *nssov_pam_svc_ad; #define WRITEBUFFER_MAXSIZE 64*1024 /* Find the given attribute's value in the RDN of the DN */ -int nssov_find_rdnval(struct berval *dn, AttributeDescription *ad, struct berval *value) +void nssov_find_rdnval(struct berval *dn, AttributeDescription *ad, struct berval *value) { struct berval rdn; char *next; @@ -406,10 +406,10 @@ static void *acceptconn(void *ctx, void *arg) if ((errno==EINTR)||(errno==EAGAIN)||(errno==EWOULDBLOCK)) { Debug( LDAP_DEBUG_TRACE,"nssov: accept() failed (ignored): %s",strerror(errno),0,0); - return; + return NULL; } Debug( LDAP_DEBUG_ANY,"nssov: accept() failed: %s",strerror(errno),0,0); - return; + return NULL; } /* make sure O_NONBLOCK is not inherited */ if ((j=fcntl(csock,F_GETFL,0))<0) @@ -417,14 +417,14 @@ static void *acceptconn(void *ctx, void *arg) Debug( LDAP_DEBUG_ANY,"nssov: fcntl(F_GETFL) failed: %s",strerror(errno),0,0); if (close(csock)) Debug( LDAP_DEBUG_ANY,"nssov: problem closing socket: %s",strerror(errno),0,0); - return; + return NULL; } if (fcntl(csock,F_SETFL,j&~O_NONBLOCK)<0) { Debug( LDAP_DEBUG_ANY,"nssov: fcntl(F_SETFL,~O_NONBLOCK) failed: %s",strerror(errno),0,0); if (close(csock)) Debug( LDAP_DEBUG_ANY,"nssov: problem closing socket: %s",strerror(errno),0,0); - return; + return NULL; } } connection_fake_init( &conn, &opbuf, ctx ); @@ -435,6 +435,8 @@ static void *acceptconn(void *ctx, void *arg) /* handle the connection */ handleconnection(ni,csock,op); + + return NULL; } static slap_verbmasks nss_svcs[] = { @@ -769,7 +771,6 @@ nssov_db_init( { slap_overinst *on = (slap_overinst *)be->bd_info; nssov_info *ni; - nssov_mapinfo *mi; int rc; rc = nssov_pam_init(); @@ -802,6 +803,7 @@ nssov_db_destroy( BackendDB *be, ConfigReply *cr ) { + return 0; } static int @@ -958,6 +960,7 @@ nssov_db_close( strerror(errno),0,0); } } + return 0; } static slap_overinst nssov; diff --git a/contrib/slapd-modules/nssov/nssov.h b/contrib/slapd-modules/nssov/nssov.h index eae55f7655..bef9495969 100644 --- a/contrib/slapd-modules/nssov/nssov.h +++ b/contrib/slapd-modules/nssov/nssov.h @@ -164,6 +164,9 @@ void nssov_cfg_init(nssov_info *ni,const char *fname); } \ } \ +/* Find the given attribute's value in the RDN of the DN. */ +void nssov_find_rdnval(struct berval *dn,AttributeDescription *ad,struct berval *value); + /* This tries to get the user password attribute from the entry. It will try to return an encrypted password as it is used in /etc/passwd, /etc/group or /etc/shadow depending upon what is in the directory. @@ -303,7 +306,6 @@ int pam_pwmod(nssov_info *ni,TFILE *fp,Operation *op,uid_t calleruid); { \ /* define common variables */ \ int32_t tmpint32; \ - int rc; \ nssov_##db##_cbp cbp; \ slap_callback cb = {0}; \ SlapReply rs = {REP_RESULT}; \ diff --git a/contrib/slapd-modules/nssov/pam.c b/contrib/slapd-modules/nssov/pam.c index c940538481..e38220a3af 100644 --- a/contrib/slapd-modules/nssov/pam.c +++ b/contrib/slapd-modules/nssov/pam.c @@ -19,6 +19,9 @@ #include "nssov.h" #include "lutil.h" +#undef ldap_debug /* silence a warning in ldap-int.h */ +#include "../../../libraries/libldap/ldap-int.h" /* for ldap_ld_free */ + static int ppolicy_cid; static AttributeDescription *ad_loginStatus; diff --git a/contrib/slapd-modules/nssov/passwd.c b/contrib/slapd-modules/nssov/passwd.c index 4e6a8c113d..e4cc61450f 100644 --- a/contrib/slapd-modules/nssov/passwd.c +++ b/contrib/slapd-modules/nssov/passwd.c @@ -207,7 +207,6 @@ static int write_passwd(nssov_passwd_cbp *cbp,Entry *entry) { int32_t tmpint32; struct berval tmparr[2], tmpuid[2]; - const char **tmpvalues; char *tmp; struct berval *names; struct berval *uids; diff --git a/contrib/slapd-modules/nssov/protocol.c b/contrib/slapd-modules/nssov/protocol.c index 058bb7926a..1f9625d220 100644 --- a/contrib/slapd-modules/nssov/protocol.c +++ b/contrib/slapd-modules/nssov/protocol.c @@ -15,7 +15,7 @@ * . */ /* -/* ACKNOWLEDGEMENTS: + * ACKNOWLEDGEMENTS: * This code references portions of the nss-ldapd package * written by Arthur de Jong. The nss-ldapd code was forked * from the nss-ldap library written by Luke Howard. @@ -50,7 +50,7 @@ NSSOV_CBPRIV(protocol, static int write_protocol(nssov_protocol_cbp *cbp,Entry *entry) { - int32_t tmpint32,tmp2int32,tmp3int32; + int32_t tmpint32; int i,numname,dupname,proto; struct berval name,*names; Attribute *a; diff --git a/contrib/slapd-modules/nssov/rpc.c b/contrib/slapd-modules/nssov/rpc.c index 0d97d32ba7..bb422ef89f 100644 --- a/contrib/slapd-modules/nssov/rpc.c +++ b/contrib/slapd-modules/nssov/rpc.c @@ -52,7 +52,7 @@ NSSOV_CBPRIV(rpc, /* write a single rpc entry to the stream */ static int write_rpc(nssov_rpc_cbp *cbp,Entry *entry) { - int32_t tmpint32,tmp2int32,tmp3int32; + int32_t tmpint32; int i,numname,dupname,number; struct berval name,*names; Attribute *a; diff --git a/contrib/slapd-modules/nssov/service.c b/contrib/slapd-modules/nssov/service.c index 7521b26ed9..ac7fa16cfa 100644 --- a/contrib/slapd-modules/nssov/service.c +++ b/contrib/slapd-modules/nssov/service.c @@ -112,8 +112,8 @@ NSSOV_CBPRIV(service, static int write_service(nssov_service_cbp *cbp,Entry *entry) { - int32_t tmpint32,tmp2int32,tmp3int32; - struct berval name,*names,*ports,*protos; + int32_t tmpint32; + struct berval name,*names,*protos; struct berval tmparr[2]; Attribute *a; char *tmp; -- 2.39.5