diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2007-06-12 11:09:02 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2007-06-12 11:09:02 +0200 |
commit | 22c1f37699777400d3692be67534d67651bef2fe (patch) | |
tree | 8bb1066d88810677f4706d97ed68ed8f95bc5f89 | |
parent | afc4d034fdfd798629572003bdb379d1c0e3345e (diff) |
fix casts of types where needed
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@285 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | common/dict.c | 1 | ||||
-rw-r--r-- | nslcd/ldap-nss.c | 29 | ||||
-rw-r--r-- | nslcd/ldap-schema.c | 32 | ||||
-rw-r--r-- | nslcd/util.c | 8 |
4 files changed, 32 insertions, 38 deletions
diff --git a/common/dict.c b/common/dict.c index 84c30d7..5178a6f 100644 --- a/common/dict.c +++ b/common/dict.c @@ -53,6 +53,7 @@ static struct dict_entry *dict_entry_new(const char *key) return NULL; } entry->value=NULL; + entry->next=NULL; return entry; } diff --git a/nslcd/ldap-nss.c b/nslcd/ldap-nss.c index da1c721..9bcc930 100644 --- a/nslcd/ldap-nss.c +++ b/nslcd/ldap-nss.c @@ -43,12 +43,7 @@ #include <sys/un.h> #endif #include <netinet/in.h> -#ifdef HAVE_LBER_H -#include <lber.h> -#endif -#ifdef HAVE_LDAP_H #include <ldap.h> -#endif #ifdef HAVE_LDAP_SSL_H #include <ldap_ssl.h> #endif @@ -2060,16 +2055,14 @@ _nss_ldap_read (const char *dn, const char **attributes, LDAPMessage ** res) * Simple wrapper around ldap_get_values(). Requires that * session is already established. */ -char ** -_nss_ldap_get_values (LDAPMessage * e, const char *attr) +char **_nss_ldap_get_values(LDAPMessage *e,const char *attr) { - if (__session.ls_state != LS_CONNECTED_TO_DSA) - { - return NULL; - } - assert (__session.ls_conn != NULL); - - return ldap_get_values (__session.ls_conn, e, (char *) attr); + if (__session.ls_state!=LS_CONNECTED_TO_DSA) + { + return NULL; + } + assert(__session.ls_conn!=NULL); + return ldap_get_values(__session.ls_conn,e,attr); } /* @@ -2697,7 +2690,7 @@ _nss_ldap_assign_attrvals (LDAPMessage * e, return NSS_STATUS_UNAVAIL; } - vals = ldap_get_values (__session.ls_conn, e, (char *) attr); + vals=ldap_get_values(__session.ls_conn,e,attr); valcount = (vals == NULL) ? 0 : ldap_count_values (vals); if (bytesleft (buffer, buflen, char *) < (valcount + 1) * sizeof (char *)) @@ -2778,7 +2771,7 @@ int _nss_ldap_write_attrvals(TFILE *fp,LDAPMessage *e,const char *attr) if (__session.ls_conn==NULL) return NSLCD_RESULT_UNAVAIL; /* get the values and the number of values */ - vals=ldap_get_values(__session.ls_conn,e,(char *)attr); + vals=ldap_get_values(__session.ls_conn,e,attr); valcount=(vals==NULL)?0:ldap_count_values(vals); /* write number of entries */ WRITE_INT32(fp,valcount); @@ -2827,7 +2820,7 @@ _nss_ldap_assign_attrval (LDAPMessage * e, return NSS_STATUS_UNAVAIL; } - vals = ldap_get_values (__session.ls_conn, e, (char *) attr); + vals=ldap_get_values(__session.ls_conn,e,attr); if (vals == NULL) { def = _nss_ldap_map_df(attr); @@ -2941,7 +2934,7 @@ _nss_ldap_assign_userpassword (LDAPMessage * e, return NSS_STATUS_UNAVAIL; } - vals=ldap_get_values(__session.ls_conn,e,(char *)attr); + vals=ldap_get_values(__session.ls_conn,e,attr); pwd=_nss_ldap_locate_userpassword(vals); vallen=strlen(pwd); diff --git a/nslcd/ldap-schema.c b/nslcd/ldap-schema.c index b335abe..81b9286 100644 --- a/nslcd/ldap-schema.c +++ b/nslcd/ldap-schema.c @@ -301,15 +301,15 @@ init_sp_attributes (const char ***sp_attrs) (*sp_attrs) = __sp_attrs; - (*sp_attrs)[0] = (char *) ATM (LM_SHADOW, uid); - (*sp_attrs)[1] = (char *) ATM (LM_SHADOW, userPassword); - (*sp_attrs)[2] = (char *) AT (shadowLastChange); - (*sp_attrs)[3] = (char *) AT (shadowMax); - (*sp_attrs)[4] = (char *) AT (shadowMin); - (*sp_attrs)[5] = (char *) AT (shadowWarning); - (*sp_attrs)[6] = (char *) AT (shadowInactive); - (*sp_attrs)[7] = (char *) AT (shadowExpire); - (*sp_attrs)[8] = (char *) AT (shadowFlag); + (*sp_attrs)[0] = ATM (LM_SHADOW, uid); + (*sp_attrs)[1] = ATM (LM_SHADOW, userPassword); + (*sp_attrs)[2] = AT (shadowLastChange); + (*sp_attrs)[3] = AT (shadowMax); + (*sp_attrs)[4] = AT (shadowMin); + (*sp_attrs)[5] = AT (shadowWarning); + (*sp_attrs)[6] = AT (shadowInactive); + (*sp_attrs)[7] = AT (shadowExpire); + (*sp_attrs)[8] = AT (shadowFlag); (*sp_attrs)[9] = NULL; } @@ -321,12 +321,12 @@ init_grp_attributes (const char ***grp_attrs) (*grp_attrs) = __grp_attrs; - (*grp_attrs)[i++] = (char *) ATM (LM_GROUP, cn); - (*grp_attrs)[i++] = (char *) ATM (LM_GROUP, userPassword); - (*grp_attrs)[i++] = (char *) AT (memberUid); + (*grp_attrs)[i++] = ATM (LM_GROUP, cn); + (*grp_attrs)[i++] = ATM (LM_GROUP, userPassword); + (*grp_attrs)[i++] = AT (memberUid); if (_nss_ldap_test_config_flag (NSS_LDAP_FLAGS_RFC2307BIS)) - (*grp_attrs)[i++] = (char *) AT (uniqueMember); - (*grp_attrs)[i++] = (char *) ATM (LM_GROUP, gidNumber); + (*grp_attrs)[i++] = AT (uniqueMember); + (*grp_attrs)[i++] = ATM (LM_GROUP, gidNumber); (*grp_attrs)[i] = NULL; } @@ -337,8 +337,8 @@ init_hosts_attributes (const char ***hosts_attrs) (*hosts_attrs) = __hosts_attrs; - (*hosts_attrs)[0] = (char *) ATM (LM_HOSTS, cn); - (*hosts_attrs)[1] = (char *) AT (ipHostNumber); + (*hosts_attrs)[0] = ATM (LM_HOSTS, cn); + (*hosts_attrs)[1] = AT (ipHostNumber); (*hosts_attrs)[2] = NULL; } diff --git a/nslcd/util.c b/nslcd/util.c index f4b3ea4..ecac7b7 100644 --- a/nslcd/util.c +++ b/nslcd/util.c @@ -229,9 +229,9 @@ dn2uid_cache_put (const char *dn, const char *uid) } } - key.data = (void *) dn; + key.data = (const void *) dn; key.size = strlen (dn); - val.data = (void *) uid; + val.data = (const void *) uid; val.size = strlen (uid); status = old_dict_put (__cache, &key, &val); @@ -255,7 +255,7 @@ dn2uid_cache_get (const char *dn, char **uid, char **buffer, size_t * buflen) return NSS_STATUS_NOTFOUND; } - key.data = (void *) dn; + key.data = (const void *) dn; key.size = strlen (dn); status = old_dict_get (__cache, 0, &key, &val); @@ -272,7 +272,7 @@ dn2uid_cache_get (const char *dn, char **uid, char **buffer, size_t * buflen) } *uid = *buffer; - memcpy (*uid, (char *) val.data, val.size); + memcpy (*uid, (const char *) val.data, val.size); (*uid)[val.size] = '\0'; *buffer += val.size + 1; *buflen -= val.size + 1; |