Take address of enclosing structure (in_addr), not member (s_addr).

This commit is contained in:
Kurt Zeilenga 1999-11-03 21:14:19 +00:00
parent 2c87d24f31
commit 4a431684d0
9 changed files with 23 additions and 22 deletions

View File

@ -7,6 +7,7 @@ Changes included in OpenLDAP 1.2 Release Engineering
Fixed -lldap templates y2k bug (ITS#294)
Fixed ldbm db_appinit to use u_int32_t instead of int (ITS#295)
Fixed lber/io.c Cray T90 specific pointer arithmetic problem (ITS#325)
Fixed s_addr dereferencing (ITS#340)
Added TCP_NODELAY support
Changed slapd to apply ACL to lastmod attributes
Changed slapd.conf default referral

View File

@ -135,8 +135,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 ) );

View File

@ -195,8 +195,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 );
@ -239,8 +239,8 @@ main( int argc, char **argv )
exit( 1 );
}
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)",

View File

@ -221,8 +221,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 );
@ -267,8 +267,8 @@ main (int argc, char **argv )
exit( 1 );
}
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)",

View File

@ -126,9 +126,9 @@ cldap_open( 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 ) {
close( s );
free( ld );

View File

@ -103,9 +103,9 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
(void)memset( (char *)&sin, 0, sizeof( struct sockaddr_in ));
sin.sin_family = AF_INET;
sin.sin_port = port;
SAFEMEMCPY( (char *) &sin.sin_addr.s_addr,
SAFEMEMCPY( (char *) &sin.sin_addr,
( use_hp ? (char *) hp->h_addr_list[ i ] :
(char *) &address ), sizeof( sin.sin_addr.s_addr) );
(char *) &address ), sizeof( sin.sin_addr ) );
if ( connect( s, (struct sockaddr *)&sin,
sizeof( struct sockaddr_in )) >= 0 ) {

View File

@ -318,8 +318,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 );
@ -400,8 +400,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,

View File

@ -271,8 +271,8 @@ slapd_daemon(
#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) {
client_name = hp->h_name;

View File

@ -250,8 +250,8 @@ main( int argc, char **argv )
flen = sizeof(from);
if ( getpeername( 0, (struct sockaddr *) &from, &flen ) == 0 ) {
#ifdef SLAPD_RLOOKUPS
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 );
#else
hp = NULL;
#endif