merge strcpy_truncate branch
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5027 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -307,8 +307,7 @@ pop_init(POP *p,int argcount,char **argmessage)
|
||||
|
||||
/* Save the dotted decimal form of the client's IP address
|
||||
in the POP parameter block */
|
||||
strncpy (p->ipaddr, inet_ntoa(cs.sin_addr), sizeof(p->ipaddr));
|
||||
p->ipaddr[sizeof(p->ipaddr) - 1] = '\0';
|
||||
strcpy_truncate (p->ipaddr, inet_ntoa(cs.sin_addr), sizeof(p->ipaddr));
|
||||
|
||||
/* Save the client's port */
|
||||
p->ipport = ntohs(cs.sin_port);
|
||||
@@ -320,7 +319,7 @@ pop_init(POP *p,int argcount,char **argmessage)
|
||||
if (ch == NULL){
|
||||
pop_log(p,POP_PRIORITY,
|
||||
"Unable to get canonical name of client, err = %d",errno);
|
||||
strcpy (p->client, p->ipaddr);
|
||||
strcpy_truncate (p->client, p->ipaddr, sizeof(p->client));
|
||||
}
|
||||
/* Save the cannonical name of the client host in
|
||||
the POP parameter block */
|
||||
@@ -335,13 +334,12 @@ pop_init(POP *p,int argcount,char **argmessage)
|
||||
pop_log(p,POP_PRIORITY,
|
||||
"Client at \"%s\" resolves to an unknown host name \"%s\"",
|
||||
p->ipaddr,ch->h_name);
|
||||
strcpy (p->client, p->ipaddr);
|
||||
strcpy_truncate (p->client, p->ipaddr, sizeof(p->client));
|
||||
}
|
||||
else {
|
||||
/* Save the host name (the previous value was
|
||||
destroyed by gethostbyname) */
|
||||
strncpy (p->client, ch_again->h_name, sizeof(p->client));
|
||||
p->client[sizeof(p->client) - 1] = '\0';
|
||||
strcpy_truncate (p->client, ch_again->h_name, sizeof(p->client));
|
||||
|
||||
/* Look for the client's IP address in the list returned
|
||||
for its name */
|
||||
@@ -354,7 +352,7 @@ pop_init(POP *p,int argcount,char **argmessage)
|
||||
pop_log (p,POP_PRIORITY,
|
||||
"Client address \"%s\" not listed for its host name \"%s\"",
|
||||
p->ipaddr,ch->h_name);
|
||||
strcpy (p->client, p->ipaddr);
|
||||
strcpy_truncate (p->client, p->ipaddr, sizeof(p->client));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user