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:
@@ -35,6 +35,11 @@ Sat Apr 4 15:13:56 1998 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* popper.h: include <io.h>
|
||||
|
||||
Sat Feb 7 10:07:39 1998 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* pop_pass.c(krb4_verify_password: Don't use REALM_SZ + 1, just
|
||||
REALM_SZ
|
||||
|
||||
Mon Dec 29 16:37:26 1997 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* pop_updt.c (pop_updt): lseek before ftruncating the file. From
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska H<>gskolan
|
||||
* Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska H<>gskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -55,7 +55,8 @@ loop(int s)
|
||||
err(1, "select");
|
||||
if(FD_ISSET(0, &fds)){
|
||||
fgets(cmd, sizeof(cmd), stdin);
|
||||
strcpy(cmd + strlen(cmd) - 1, "\r\n");
|
||||
cmd[strlen(cmd) - 1] = '\0';
|
||||
strcat_truncate (cmd, "\r\n", sizeof(cmd));
|
||||
write(s, cmd, strlen(cmd));
|
||||
}
|
||||
if(FD_ISSET(s, &fds)){
|
||||
|
@@ -73,7 +73,7 @@ pop_dropcopy(POP *p, struct passwd *pwp)
|
||||
* running as root.
|
||||
*/
|
||||
|
||||
strcpy(template, POP_TMPDROP);
|
||||
strcpy_truncate(template, POP_TMPDROP, sizeof(template));
|
||||
if ((tf_fd = mkstemp(template)) < 0 ||
|
||||
(tf = fdopen(tf_fd, "w+")) == NULL) {
|
||||
pop_log(p,POP_PRIORITY,
|
||||
|
@@ -46,7 +46,7 @@ pop_get_command(POP *p, char *mp)
|
||||
|
||||
/* Save a copy of the original client line */
|
||||
#ifdef DEBUG
|
||||
if(p->debug) strcpy (buf,mp);
|
||||
if(p->debug) strcpy_truncate (buf, mp, sizeof(buf));
|
||||
#endif /* DEBUG */
|
||||
|
||||
/* Parse the message into the parameter array */
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ pop_msg(POP *p, int stat, char *format, ...)
|
||||
pop_log(p,POP_PRIORITY,"%s",message);
|
||||
|
||||
/* Append the <CR><LF> */
|
||||
strncat(message, "\r\n", sizeof(message) - strlen(message));
|
||||
strcat_truncate(message, "\r\n", sizeof(message));
|
||||
|
||||
/* Send the message to the client */
|
||||
fputs(message, p->output);
|
||||
|
@@ -12,7 +12,7 @@ static int
|
||||
krb4_verify_password (POP *p)
|
||||
{
|
||||
int status;
|
||||
char lrealm[REALM_SZ + 1];
|
||||
char lrealm[REALM_SZ];
|
||||
char tkt[MaxPathLen];
|
||||
|
||||
status = krb_get_lrealm(lrealm,1);
|
||||
|
@@ -115,10 +115,10 @@ pop_send(POP *p)
|
||||
*return_path_end = '\0';
|
||||
if (strlen(return_path_adr) != 0 && *return_path_adr != '\n') {
|
||||
static char tmpbuf[MAXMSGLINELEN + 20];
|
||||
strcpy(tmpbuf, "Return-Path: ");
|
||||
strcat(tmpbuf, return_path_adr);
|
||||
strcat(tmpbuf, "\n");
|
||||
if (strlen(tmpbuf) < MAXMSGLINELEN) {
|
||||
if (snprintf (tmpbuf,
|
||||
sizeof(tmpbuf),
|
||||
"Return-Path: %s\n",
|
||||
return_path_adr) < MAXMSGLINELEN) {
|
||||
pop_sendline (p,tmpbuf);
|
||||
if (hangup)
|
||||
return pop_msg (p, POP_FAILURE,
|
||||
|
@@ -16,7 +16,7 @@ pop_user (POP *p)
|
||||
{
|
||||
char ss[256];
|
||||
|
||||
strcpy(p->user, p->pop_parm[1]);
|
||||
strcpy_truncate(p->user, p->pop_parm[1], sizeof(p->user));
|
||||
|
||||
#ifdef OTP
|
||||
if (otp_challenge (&p->otp_ctx, p->user, ss, sizeof(ss)) == 0) {
|
||||
|
Reference in New Issue
Block a user