Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2008-06-06 16:06:43 +0200
committerArthur de Jong <arthur@arthurdejong.org>2008-06-06 16:06:43 +0200
commit4a86f16e54efbf9693529c1bfd2b947146913583 (patch)
tree6971db94a5d0f455ddcb94a3a6804c2737a28b00
parentdacd740209fc1fcf474cf247156cfd3bd2b57c7f (diff)
miscellaneous portability improvements
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@742 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--common/dict.c4
-rw-r--r--compat/ether.c8
-rw-r--r--nslcd/group.c2
-rw-r--r--nslcd/myldap.c11
-rw-r--r--nslcd/passwd.c2
-rw-r--r--tests/test_tio.c6
6 files changed, 28 insertions, 5 deletions
diff --git a/common/dict.c b/common/dict.c
index b2a6ab2..1bad382 100644
--- a/common/dict.c
+++ b/common/dict.c
@@ -26,7 +26,9 @@
#include <string.h>
#include <strings.h>
#include <ctype.h>
+#ifdef HAVE_STDINT_H
#include <stdint.h>
+#endif /* HAVE_STDINT_H */
#include "dict.h"
@@ -227,7 +229,7 @@ int dict_put(DICT *dict,const char *key,void *value)
buf=(char *)malloc(sizeof(struct dict_entry)+l);
if (buf==NULL)
return -1;
- entry=(struct dict_entry *)buf;
+ entry=(struct dict_entry *)(void *)buf;
buf+=sizeof(struct dict_entry);
strcpy(buf,key);
entry->hash=hash;
diff --git a/compat/ether.c b/compat/ether.c
index 1374f97..707adf7 100644
--- a/compat/ether.c
+++ b/compat/ether.c
@@ -22,6 +22,14 @@
#include "config.h"
#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+#ifdef HAVE_NETINET_ETHER_H
+#include <netinet/ether.h>
+#endif
#include "ether.h"
diff --git a/nslcd/group.c b/nslcd/group.c
index 0d3a5b5..c101947 100644
--- a/nslcd/group.c
+++ b/nslcd/group.c
@@ -99,7 +99,7 @@ static int mkfilter_group_bygid(gid_t gid,
return mysnprintf(buffer,buflen,
"(&%s(%s=%d))",
group_filter,
- attmap_group_gidNumber,gid);
+ attmap_group_gidNumber,(int)gid);
}
/* create a search filter for searching a group entry
diff --git a/nslcd/myldap.c b/nslcd/myldap.c
index e630dcc..ae133e5 100644
--- a/nslcd/myldap.c
+++ b/nslcd/myldap.c
@@ -38,6 +38,9 @@
/* also include deprecated LDAP functions for now */
#define LDAP_DEPRECATED 1
+/* for compatibility on Solaris */
+#define LDAP_REFERRALS 1
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -346,10 +349,12 @@ static int do_sasl_interact(LDAP UNUSED(*ld),unsigned UNUSED(flags),void *defaul
This returns an LDAP result code. */
static int do_bind(MYLDAP_SESSION *session,const char *uri)
{
+#ifdef HAVE_LDAP_SASL_INTERACTIVE_BIND_S
int rc;
#ifndef HAVE_SASL_INTERACT_T
struct berval cred;
#endif /* not HAVE_SASL_INTERACT_T */
+#ifdef LDAP_OPT_X_TLS
/* check if StartTLS is requested */
if (nslcd_cfg->ldc_ssl_on==SSL_START_TLS)
{
@@ -361,15 +366,18 @@ static int do_bind(MYLDAP_SESSION *session,const char *uri)
return rc;
}
}
+#endif /* LDAP_OPT_X_TLS */
/* TODO: store this information in the session */
if (!nslcd_cfg->ldc_usesasl)
{
+#endif /* HAVE_LDAP_SASL_INTERACTIVE_BIND_S */
/* do a simple bind */
if (nslcd_cfg->ldc_binddn)
log_log(LOG_DEBUG,"simple bind to %s as %s",uri,nslcd_cfg->ldc_binddn);
else
log_log(LOG_DEBUG,"simple anonymous bind to %s",uri);
return ldap_simple_bind_s(session->ld,nslcd_cfg->ldc_binddn,nslcd_cfg->ldc_bindpw);
+#ifdef HAVE_LDAP_SASL_INTERACTIVE_BIND_S
}
else
{
@@ -389,6 +397,7 @@ static int do_bind(MYLDAP_SESSION *session,const char *uri)
return ldap_sasl_bind_s(session->ld,nslcd_cfg->ldc_binddn,"GSSAPI",&cred,NULL,NULL,NULL);
#endif /* not HAVE_SASL_INTERACT_T */
}
+#endif /* HAVE_LDAP_SASL_INTERACTIVE_BIND_S */
}
#ifdef HAVE_LDAP_SET_REBIND_PROC
@@ -1197,7 +1206,7 @@ static char **set2values(SET *set)
set_free(set);
return NULL;
}
- values=(char **)buf;
+ values=(char **)(void *)buf;
buf+=num*sizeof(char *);
/* copy set into buffer */
sz=0;
diff --git a/nslcd/passwd.c b/nslcd/passwd.c
index beb9ebf..d28d6f2 100644
--- a/nslcd/passwd.c
+++ b/nslcd/passwd.c
@@ -96,7 +96,7 @@ static int mkfilter_passwd_byuid(uid_t uid,
return mysnprintf(buffer,buflen,
"(&%s(%s=%d))",
passwd_filter,
- attmap_passwd_uidNumber,uid);
+ attmap_passwd_uidNumber,(int)uid);
}
static void passwd_init(void)
diff --git a/tests/test_tio.c b/tests/test_tio.c
index 82586e4..6f4410d 100644
--- a/tests/test_tio.c
+++ b/tests/test_tio.c
@@ -36,9 +36,13 @@
#include "common/tio.h"
+#ifndef __ASSERT_FUNCTION
+#define __ASSERT_FUNCTION ""
+#endif /* not __ASSERT_FUNCTION */
+
#define assertok(expr) \
((expr) \
- ? __ASSERT_VOID_CAST (0) \
+ ? (void) (0) \
: __assertok_fail(__STRING(expr),__FILE__,__LINE__,__ASSERT_FUNCTION))
static void __assertok_fail(const char *expr,const char *file,