From: Kurt Zeilenga Date: Sat, 1 Mar 2003 19:47:04 +0000 (+0000) Subject: Don't send extra messages, will cause interoperability problems X-Git-Tag: NO_SLAP_OP_BLOCKS~227 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=81d2b2bb65357f977ac1f4598b5606f3de873b48;p=openldap Don't send extra messages, will cause interoperability problems with versions not built to receive these extra messages. Likewise in reverse. --- diff --git a/libraries/libldap/os-local.c b/libraries/libldap/os-local.c index 0e03335de6..833328fd90 100644 --- a/libraries/libldap/os-local.c +++ b/libraries/libldap/os-local.c @@ -131,10 +131,6 @@ ldap_pvt_is_socket_ready(LDAP *ld, int s) } #undef TRACE -#if !defined(HAVE_GETPEEREID) && !defined(SO_PEERCRED) && !defined(LOCAL_PEERCRED) && defined(HAVE_SENDMSG) -#define DO_SENDMSG -#endif - static int ldap_pvt_connect(LDAP *ld, ber_socket_t s, struct sockaddr_un *sa, int async) { @@ -159,25 +155,6 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s, struct sockaddr_un *sa, int async) if ( ldap_pvt_ndelay_off(ld, s) == -1 ) { return ( -1 ); } -#ifdef DO_SENDMSG - /* Send a dummy message with access rights. Remote side will - * obtain our uid/gid by fstat'ing this descriptor. - */ -sendcred: { - int fds[2]; - struct iovec iov = {(char *)fds, sizeof(int)}; - struct msghdr msg = {0}; - if (pipe(fds) == 0) { - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - msg.msg_accrights = (char *)fds; - msg.msg_accrightslen = sizeof(int); - sendmsg( s, &msg, 0 ); - close(fds[0]); - close(fds[1]); - } - } -#endif return ( 0 ); } diff --git a/libraries/liblutil/getpeereid.c b/libraries/liblutil/getpeereid.c index f8f6e22c2c..15d908f1ea 100644 --- a/libraries/liblutil/getpeereid.c +++ b/libraries/liblutil/getpeereid.c @@ -18,11 +18,6 @@ #include #endif -#if !defined(SO_PEERCRED) && !defined(LOCAL_PEERCRED) && defined(HAVE_SENDMSG) -#define DO_SENDMSG -#include -#endif - int getpeereid( int s, uid_t *euid, gid_t *egid ) { #ifdef LDAP_PF_LOCAL @@ -51,31 +46,6 @@ int getpeereid( int s, uid_t *euid, gid_t *egid ) *egid = peercred.cr_gid; return 0; } -#elif defined( DO_SENDMSG ) - int dummy, fd[2]; - struct iovec iov = {(char *)&dummy, sizeof(dummy)}; - struct msghdr msg = {0}; - struct stat st; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - msg.msg_accrights = (char *)fd; - msg.msg_accrightslen = sizeof(fd); - if( recvmsg( s, &msg, 0) >= 0 && msg.msg_accrightslen == sizeof(int) ) - { - /* We must receive a valid descriptor, it must be a pipe, - * and it must only be accessible by its owner. - */ - dummy = fstat( fd[0], &st ); - close(fd[0]); - if( dummy == 0 && S_ISFIFO(st.st_mode) && - ((st.st_mode & (S_IRWXG|S_IRWXO)) == 0)) - { - *euid = st.st_uid; - *egid = st.st_gid; - return 0; - } - } -#endif #endif return -1;