From: Kurt Zeilenga Date: Sat, 30 Oct 1999 04:58:06 +0000 (+0000) Subject: Do not attempt to obtain sizeof(sin_addr.s_addr) or &sin_addr.s_addr X-Git-Tag: UCDATA_2_4~272 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=baa34f752b1bed4a246e6f44f6f94d5fa3cdea97;p=openldap Do not attempt to obtain sizeof(sin_addr.s_addr) or &sin_addr.s_addr as s_addr member of in_addr may be a bitfield. --- diff --git a/clients/finger/main.c b/clients/finger/main.c index 5e84fe4916..45b0d90ac3 100644 --- a/clients/finger/main.c +++ b/clients/finger/main.c @@ -136,8 +136,8 @@ main( int argc, char **argv ) } if ( dosyslog && !interactive ) { - hp = gethostbyaddr( (char *) &peername.sin_addr.s_addr, - sizeof(peername.sin_addr.s_addr), AF_INET ); + hp = gethostbyaddr( (char *) &peername.sin_addr, + sizeof(peername.sin_addr), AF_INET ); syslog( LOG_INFO, "connection from %s (%s)", (hp == NULL) ? "unknown" : hp->h_name, inet_ntoa( peername.sin_addr ) ); diff --git a/clients/gopher/go500.c b/clients/gopher/go500.c index e8342fc4a6..ff3bb2254e 100644 --- a/clients/gopher/go500.c +++ b/clients/gopher/go500.c @@ -203,8 +203,8 @@ main( int argc, char **argv ) fromlen = sizeof(from); if ( getpeername( 0, (struct sockaddr *) &from, &fromlen ) == 0 ) { - hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr), - sizeof(from.sin_addr.s_addr), AF_INET ); + hp = gethostbyaddr( (char *) &(from.sin_addr), + sizeof(from.sin_addr), AF_INET ); Debug( LDAP_DEBUG_ARGS, "connection from %s (%s)\n", (hp == NULL) ? "unknown" : hp->h_name, inet_ntoa( from.sin_addr ), 0 ); @@ -247,8 +247,8 @@ main( int argc, char **argv ) exit( EXIT_FAILURE ); } - hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr), - sizeof(from.sin_addr.s_addr), AF_INET ); + hp = gethostbyaddr( (char *) &(from.sin_addr), + sizeof(from.sin_addr), AF_INET ); if ( dosyslog ) { syslog( LOG_INFO, "TCP connection from %s (%s)", diff --git a/clients/gopher/go500gw.c b/clients/gopher/go500gw.c index c1c5ab4a9e..21939f3ca5 100644 --- a/clients/gopher/go500gw.c +++ b/clients/gopher/go500gw.c @@ -226,8 +226,8 @@ main (int argc, char **argv ) fromlen = sizeof(from); if ( getpeername( 0, (struct sockaddr *) &from, &fromlen ) == 0 ) { - hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr), - sizeof(from.sin_addr.s_addr), AF_INET ); + hp = gethostbyaddr( (char *) &(from.sin_addr), + sizeof(from.sin_addr), AF_INET ); Debug( LDAP_DEBUG_ARGS, "connection from %s (%s)\n", (hp == NULL) ? "unknown" : hp->h_name, inet_ntoa( from.sin_addr ), 0 ); @@ -272,8 +272,8 @@ main (int argc, char **argv ) exit( EXIT_FAILURE ); } - hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr), - sizeof(from.sin_addr.s_addr), AF_INET ); + hp = gethostbyaddr( (char *) &(from.sin_addr), + sizeof(from.sin_addr), AF_INET ); if ( dosyslog ) { syslog( LOG_INFO, "TCP connection from %s (%s)", diff --git a/include/ldap.h b/include/ldap.h index cda3ad767a..9a5ed0bb17 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -170,10 +170,16 @@ typedef struct ldapcontrol { #define LDAP_CONTROL_MANAGEDSAIT "2.16.840.1.113730.3.4.2" +/* Experimental Controls */ +#define LDAP_CONTROL_X_PASSWD_MOD_REQ "1.3.6.1.4.1.4203.666.5.1" +#define LDAP_CONTROL_X_PASSWD_MOD_RES "1.3.6.1.4.1.4203.666.5.1" + + /* LDAP Unsolicited Notifications */ #define LDAP_NOTICE_OF_DISCONNECTION "1.3.6.1.4.1.1466.20036" #define LDAP_NOTICE_DISCONNECT LDAP_NOTICE_OF_DISCONNECTION + /* LDAP Extended Operations */ diff --git a/libraries/libldap/cldap.c b/libraries/libldap/cldap.c index de6208136b..46872b4741 100644 --- a/libraries/libldap/cldap.c +++ b/libraries/libldap/cldap.c @@ -129,9 +129,9 @@ cldap_open( LDAP_CONST char *host, int port ) } for ( i = 0; hp->h_addr_list[ i ] != 0; ++i ) { - SAFEMEMCPY( (char *)&sock.sin_addr.s_addr, + SAFEMEMCPY( (char *)&sock.sin_addr, (char *)hp->h_addr_list[ i ], - sizeof(sock.sin_addr.s_addr)); + sizeof(sock.sin_addr)); if ( add_addr( ld, (struct sockaddr *)&sock ) < 0 ) { ldap_ld_free( ld, 1, NULL, NULL ); LDAP_FREE( host_dup ); diff --git a/libraries/libldap/os-ip.c b/libraries/libldap/os-ip.c index 0ed3c90046..beba17ebbf 100644 --- a/libraries/libldap/os-ip.c +++ b/libraries/libldap/os-ip.c @@ -303,9 +303,9 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb, const char *host, (void)memset((char *)&sin, 0, sizeof(struct sockaddr_in)); sin.sin_family = AF_INET; sin.sin_port = port; - p = (char *)&sin.sin_addr.s_addr; + p = (char *)&sin.sin_addr; q = use_hp ? (char *)hp->h_addr_list[i] : (char *)&address; - SAFEMEMCPY(p, q, sizeof(p) ); + SAFEMEMCPY(p, q, sizeof(sin.sin_addr) ); osip_debug(ld, "ldap_connect_to_host: Trying %s:%d\n", inet_ntoa(sin.sin_addr),ntohs(sin.sin_port),0); diff --git a/servers/ldapd/main.c b/servers/ldapd/main.c index 764f4e9c09..193f7446d0 100644 --- a/servers/ldapd/main.c +++ b/servers/ldapd/main.c @@ -319,8 +319,8 @@ main( int argc, char **argv ) len = sizeof(from); if ( getpeername( ns, (struct sockaddr *) &from, &len ) == 0 ) { - hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr), - sizeof(from.sin_addr.s_addr), AF_INET ); + hp = gethostbyaddr( (char *) &(from.sin_addr), + sizeof(from.sin_addr), AF_INET ); Debug( LDAP_DEBUG_ARGS, "connection from %s (%s)\n", (hp == NULL) ? "unknown" : hp->h_name, inet_ntoa( from.sin_addr ), 0 ); @@ -401,8 +401,8 @@ main( int argc, char **argv ) continue; } - hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr), - sizeof(from.sin_addr.s_addr), AF_INET ); + hp = gethostbyaddr( (char *) &(from.sin_addr), + sizeof(from.sin_addr), AF_INET ); #ifdef HAVE_TCPD if ( !hosts_ctl("ldapd", (hp == NULL) ? "unknown" : hp->h_name, diff --git a/servers/ldapd/message.c b/servers/ldapd/message.c index f9aa99309e..23a56c794a 100644 --- a/servers/ldapd/message.c +++ b/servers/ldapd/message.c @@ -165,8 +165,8 @@ get_cldap_msg( tmp->m_msgtype == msgtype && ((struct sockaddr_in *)&tmp->m_clientaddr)->sin_port == ((struct sockaddr_in *)fromaddr)->sin_port && - ((struct sockaddr_in *)&tmp->m_clientaddr)->sin_addr.s_addr - == ((struct sockaddr_in *)fromaddr)->sin_addr.s_addr ) { + ((struct sockaddr_in *)&tmp->m_clientaddr)->sin_addr + == ((struct sockaddr_in *)fromaddr)->sin_addr ) { break; } } diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index ffcf29e23d..f7072e1c12 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -664,8 +664,8 @@ slapd_daemon_task( #if defined(SLAPD_RLOOKUPS) || defined(HAVE_TCPD) hp = gethostbyaddr( (char *) - &(from.sin_addr.s_addr), - sizeof(from.sin_addr.s_addr), AF_INET ); + &(from.sin_addr), + sizeof(from.sin_addr), AF_INET ); if(hp) { dnsname = ldap_pvt_str2lower( hp->h_name );