large strc{py,at}_truncate -> strlc{py,at} replacement
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6984 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -119,16 +119,16 @@ setpeer(int argc, char **argv)
|
|||||||
/*
|
/*
|
||||||
* Set up defaults for FTP.
|
* Set up defaults for FTP.
|
||||||
*/
|
*/
|
||||||
strcpy_truncate(typename, "ascii", sizeof(typename));
|
strlcpy(typename, "ascii", sizeof(typename));
|
||||||
type = TYPE_A;
|
type = TYPE_A;
|
||||||
curtype = TYPE_A;
|
curtype = TYPE_A;
|
||||||
strcpy_truncate(formname, "non-print", sizeof(formname));
|
strlcpy(formname, "non-print", sizeof(formname));
|
||||||
form = FORM_N;
|
form = FORM_N;
|
||||||
strcpy_truncate(modename, "stream", sizeof(modename));
|
strlcpy(modename, "stream", sizeof(modename));
|
||||||
mode = MODE_S;
|
mode = MODE_S;
|
||||||
strcpy_truncate(structname, "file", sizeof(structname));
|
strlcpy(structname, "file", sizeof(structname));
|
||||||
stru = STRU_F;
|
stru = STRU_F;
|
||||||
strcpy_truncate(bytename, "8", sizeof(bytename));
|
strlcpy(bytename, "8", sizeof(bytename));
|
||||||
bytesize = 8;
|
bytesize = 8;
|
||||||
if (autologin)
|
if (autologin)
|
||||||
login(argv[1]);
|
login(argv[1]);
|
||||||
@@ -170,7 +170,7 @@ setpeer(int argc, char **argv)
|
|||||||
* for text files unless changed by the user.
|
* for text files unless changed by the user.
|
||||||
*/
|
*/
|
||||||
type = 0;
|
type = 0;
|
||||||
strcpy_truncate(typename, "binary", sizeof(typename));
|
strlcpy(typename, "binary", sizeof(typename));
|
||||||
if (overbose)
|
if (overbose)
|
||||||
printf("Using %s mode to transfer files.\n",
|
printf("Using %s mode to transfer files.\n",
|
||||||
typename);
|
typename);
|
||||||
@@ -243,7 +243,7 @@ settype(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
comret = command("TYPE %s", p->t_mode);
|
comret = command("TYPE %s", p->t_mode);
|
||||||
if (comret == COMPLETE) {
|
if (comret == COMPLETE) {
|
||||||
strcpy_truncate(typename, p->t_name, sizeof(typename));
|
strlcpy(typename, p->t_name, sizeof(typename));
|
||||||
curtype = type = p->t_type;
|
curtype = type = p->t_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -784,7 +784,7 @@ remglob(char **argv, int doswitch)
|
|||||||
}
|
}
|
||||||
if (ftemp == NULL) {
|
if (ftemp == NULL) {
|
||||||
int fd;
|
int fd;
|
||||||
strcpy_truncate(temp, _PATH_TMP_XXX, sizeof(temp));
|
strlcpy(temp, _PATH_TMP_XXX, sizeof(temp));
|
||||||
fd = mkstemp(temp);
|
fd = mkstemp(temp);
|
||||||
if(fd < 0){
|
if(fd < 0){
|
||||||
warn("unable to create temporary file %s", temp);
|
warn("unable to create temporary file %s", temp);
|
||||||
@@ -1419,11 +1419,11 @@ quote1(char *initial, int argc, char **argv)
|
|||||||
int i;
|
int i;
|
||||||
char buf[BUFSIZ]; /* must be >= sizeof(line) */
|
char buf[BUFSIZ]; /* must be >= sizeof(line) */
|
||||||
|
|
||||||
strcpy_truncate(buf, initial, sizeof(buf));
|
strlcpy(buf, initial, sizeof(buf));
|
||||||
for(i = 1; i < argc; i++) {
|
for(i = 1; i < argc; i++) {
|
||||||
if(i > 1)
|
if(i > 1)
|
||||||
strcat_truncate(buf, " ", sizeof(buf));
|
strlcat(buf, " ", sizeof(buf));
|
||||||
strcat_truncate(buf, argv[i], sizeof(buf));
|
strlcat(buf, argv[i], sizeof(buf));
|
||||||
}
|
}
|
||||||
if (command("%s", buf) == PRELIM) {
|
if (command("%s", buf) == PRELIM) {
|
||||||
while (getreply(0) == PRELIM)
|
while (getreply(0) == PRELIM)
|
||||||
@@ -1575,11 +1575,11 @@ account(int argc, char **argv)
|
|||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
++argv;
|
++argv;
|
||||||
--argc;
|
--argc;
|
||||||
strcpy_truncate (acct, *argv, sizeof(acct));
|
strlcpy (acct, *argv, sizeof(acct));
|
||||||
while (argc > 1) {
|
while (argc > 1) {
|
||||||
--argc;
|
--argc;
|
||||||
++argv;
|
++argv;
|
||||||
strcat_truncate(acct, *argv, sizeof(acct));
|
strlcat(acct, *argv, sizeof(acct));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1691,12 +1691,12 @@ setntrans(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
ntflag++;
|
ntflag++;
|
||||||
code = ntflag;
|
code = ntflag;
|
||||||
strcpy_truncate (ntin, argv[1], 17);
|
strlcpy (ntin, argv[1], 17);
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
ntout[0] = '\0';
|
ntout[0] = '\0';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
strcpy_truncate (ntout, argv[2], 17);
|
strlcpy (ntout, argv[2], 17);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@@ -1753,10 +1753,10 @@ setnmap(int argc, char **argv)
|
|||||||
cp = strchr(altarg, ' ');
|
cp = strchr(altarg, ' ');
|
||||||
}
|
}
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
strcpy_truncate(mapin, altarg, MaxPathLen);
|
strlcpy(mapin, altarg, MaxPathLen);
|
||||||
while (*++cp == ' ')
|
while (*++cp == ' ')
|
||||||
continue;
|
continue;
|
||||||
strcpy_truncate(mapout, cp, MaxPathLen);
|
strlcpy(mapout, cp, MaxPathLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@@ -2008,7 +2008,7 @@ macdef(int argc, char **argv)
|
|||||||
if (interactive) {
|
if (interactive) {
|
||||||
printf("Enter macro line by line, terminating it with a null line\n");
|
printf("Enter macro line by line, terminating it with a null line\n");
|
||||||
}
|
}
|
||||||
strcpy_truncate(macros[macnum].mac_name,
|
strlcpy(macros[macnum].mac_name,
|
||||||
argv[1],
|
argv[1],
|
||||||
sizeof(macros[macnum].mac_name));
|
sizeof(macros[macnum].mac_name));
|
||||||
if (macnum == 0) {
|
if (macnum == 0) {
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ domacro(int argc, char **argv)
|
|||||||
code = -1;
|
code = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
strcpy_truncate(line2, line, sizeof(line2));
|
strlcpy(line2, line, sizeof(line2));
|
||||||
TOP:
|
TOP:
|
||||||
cp1 = macros[i].mac_start;
|
cp1 = macros[i].mac_start;
|
||||||
while (cp1 != macros[i].mac_end) {
|
while (cp1 != macros[i].mac_end) {
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ hookup (const char *host, int port)
|
|||||||
code = -1;
|
code = -1;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strcpy_truncate (hostnamebuf, hp->h_name, sizeof(hostnamebuf));
|
strlcpy (hostnamebuf, hp->h_name, sizeof(hostnamebuf));
|
||||||
hostname = hostnamebuf;
|
hostname = hostnamebuf;
|
||||||
af = hisctladdr->sa_family = hp->h_addrtype;
|
af = hisctladdr->sa_family = hp->h_addrtype;
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ hookup (const char *host, int port)
|
|||||||
|
|
||||||
if (inet_ntop (af, socket_get_address(hisctladdr),
|
if (inet_ntop (af, socket_get_address(hisctladdr),
|
||||||
addr, sizeof(addr)) == NULL)
|
addr, sizeof(addr)) == NULL)
|
||||||
strcpy_truncate (addr, "unknown address",
|
strlcpy (addr, "unknown address",
|
||||||
sizeof(addr));
|
sizeof(addr));
|
||||||
warn ("connect %s", addr);
|
warn ("connect %s", addr);
|
||||||
close (s);
|
close (s);
|
||||||
@@ -200,7 +200,7 @@ login (char *host)
|
|||||||
else
|
else
|
||||||
user = tmp;
|
user = tmp;
|
||||||
}
|
}
|
||||||
strcpy_truncate(username, user, sizeof(username));
|
strlcpy(username, user, sizeof(username));
|
||||||
n = command("USER %s", user);
|
n = command("USER %s", user);
|
||||||
if (n == CONTINUE) {
|
if (n == CONTINUE) {
|
||||||
if(sec_complete)
|
if(sec_complete)
|
||||||
@@ -240,7 +240,7 @@ login (char *host)
|
|||||||
return (1);
|
return (1);
|
||||||
for (n = 0; n < macnum; ++n) {
|
for (n = 0; n < macnum; ++n) {
|
||||||
if (!strcmp("init", macros[n].mac_name)) {
|
if (!strcmp("init", macros[n].mac_name)) {
|
||||||
strcpy_truncate (line, "$init", sizeof (line));
|
strlcpy (line, "$init", sizeof (line));
|
||||||
makeargv();
|
makeargv();
|
||||||
domacro(margc, margv);
|
domacro(margc, margv);
|
||||||
break;
|
break;
|
||||||
@@ -1471,7 +1471,7 @@ pswitch (int flag)
|
|||||||
ip->connect = connected;
|
ip->connect = connected;
|
||||||
connected = op->connect;
|
connected = op->connect;
|
||||||
if (hostname) {
|
if (hostname) {
|
||||||
strcpy_truncate (ip->name, hostname, sizeof (ip->name));
|
strlcpy (ip->name, hostname, sizeof (ip->name));
|
||||||
} else
|
} else
|
||||||
ip->name[0] = 0;
|
ip->name[0] = 0;
|
||||||
hostname = op->name;
|
hostname = op->name;
|
||||||
@@ -1497,16 +1497,16 @@ pswitch (int flag)
|
|||||||
mcase = op->mcse;
|
mcase = op->mcse;
|
||||||
ip->ntflg = ntflag;
|
ip->ntflg = ntflag;
|
||||||
ntflag = op->ntflg;
|
ntflag = op->ntflg;
|
||||||
strcpy_truncate (ip->nti, ntin, sizeof (ip->nti));
|
strlcpy (ip->nti, ntin, sizeof (ip->nti));
|
||||||
strcpy_truncate (ntin, op->nti, 17);
|
strlcpy (ntin, op->nti, 17);
|
||||||
strcpy_truncate (ip->nto, ntout, sizeof (ip->nto));
|
strlcpy (ip->nto, ntout, sizeof (ip->nto));
|
||||||
strcpy_truncate (ntout, op->nto, 17);
|
strlcpy (ntout, op->nto, 17);
|
||||||
ip->mapflg = mapflag;
|
ip->mapflg = mapflag;
|
||||||
mapflag = op->mapflg;
|
mapflag = op->mapflg;
|
||||||
strcpy_truncate (ip->mi, mapin, MaxPathLen);
|
strlcpy (ip->mi, mapin, MaxPathLen);
|
||||||
strcpy_truncate (mapin, op->mi, MaxPathLen);
|
strlcpy (mapin, op->mi, MaxPathLen);
|
||||||
strcpy_truncate (ip->mo, mapout, MaxPathLen);
|
strlcpy (ip->mo, mapout, MaxPathLen);
|
||||||
strcpy_truncate (mapout, op->mo, MaxPathLen);
|
strlcpy (mapout, op->mo, MaxPathLen);
|
||||||
signal(SIGINT, oldintr);
|
signal(SIGINT, oldintr);
|
||||||
if (abrtflag) {
|
if (abrtflag) {
|
||||||
abrtflag = 0;
|
abrtflag = 0;
|
||||||
@@ -1680,7 +1680,7 @@ gunique (char *local)
|
|||||||
warn ("local: %s", local);
|
warn ("local: %s", local);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strcpy_truncate (new, local, sizeof(new));
|
strlcpy (new, local, sizeof(new));
|
||||||
cp = new + strlen(new);
|
cp = new + strlen(new);
|
||||||
*cp++ = '.';
|
*cp++ = '.';
|
||||||
while (!d) {
|
while (!d) {
|
||||||
|
|||||||
@@ -152,9 +152,9 @@ krb4_adat(void *app_data, void *buf, size_t len)
|
|||||||
memcpy(d->key, auth_dat.session, sizeof(d->key));
|
memcpy(d->key, auth_dat.session, sizeof(d->key));
|
||||||
des_set_key(&d->key, d->schedule);
|
des_set_key(&d->key, d->schedule);
|
||||||
|
|
||||||
strcpy_truncate(d->name, auth_dat.pname, sizeof(d->name));
|
strlcpy(d->name, auth_dat.pname, sizeof(d->name));
|
||||||
strcpy_truncate(d->instance, auth_dat.pinst, sizeof(d->instance));
|
strlcpy(d->instance, auth_dat.pinst, sizeof(d->instance));
|
||||||
strcpy_truncate(d->realm, auth_dat.prealm, sizeof(d->instance));
|
strlcpy(d->realm, auth_dat.prealm, sizeof(d->instance));
|
||||||
|
|
||||||
cs = auth_dat.checksum + 1;
|
cs = auth_dat.checksum + 1;
|
||||||
{
|
{
|
||||||
@@ -213,15 +213,15 @@ mk_auth(struct krb4_data *d, KTEXT adat,
|
|||||||
CREDENTIALS cred;
|
CREDENTIALS cred;
|
||||||
char sname[SNAME_SZ], inst[INST_SZ], realm[REALM_SZ];
|
char sname[SNAME_SZ], inst[INST_SZ], realm[REALM_SZ];
|
||||||
|
|
||||||
strcpy_truncate(sname, service, sizeof(sname));
|
strlcpy(sname, service, sizeof(sname));
|
||||||
strcpy_truncate(inst, krb_get_phost(host), sizeof(inst));
|
strlcpy(inst, krb_get_phost(host), sizeof(inst));
|
||||||
strcpy_truncate(realm, krb_realmofhost(host), sizeof(realm));
|
strlcpy(realm, krb_realmofhost(host), sizeof(realm));
|
||||||
ret = krb_mk_req(adat, sname, inst, realm, checksum);
|
ret = krb_mk_req(adat, sname, inst, realm, checksum);
|
||||||
if(ret)
|
if(ret)
|
||||||
return ret;
|
return ret;
|
||||||
strcpy_truncate(sname, service, sizeof(sname));
|
strlcpy(sname, service, sizeof(sname));
|
||||||
strcpy_truncate(inst, krb_get_phost(host), sizeof(inst));
|
strlcpy(inst, krb_get_phost(host), sizeof(inst));
|
||||||
strcpy_truncate(realm, krb_realmofhost(host), sizeof(realm));
|
strlcpy(realm, krb_realmofhost(host), sizeof(realm));
|
||||||
ret = krb_get_cred(sname, inst, realm, &cred);
|
ret = krb_get_cred(sname, inst, realm, &cred);
|
||||||
memmove(&d->key, &cred.session, sizeof(des_cblock));
|
memmove(&d->key, &cred.session, sizeof(des_cblock));
|
||||||
des_key_sched(&d->key, d->schedule);
|
des_key_sched(&d->key, d->schedule);
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
pw = k_getpwuid(getuid());
|
pw = k_getpwuid(getuid());
|
||||||
if (pw != NULL) {
|
if (pw != NULL) {
|
||||||
strcpy_truncate(homedir, pw->pw_dir, sizeof(homedir));
|
strlcpy(homedir, pw->pw_dir, sizeof(homedir));
|
||||||
home = homedir;
|
home = homedir;
|
||||||
}
|
}
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
@@ -246,7 +246,7 @@ cmdscanner(int top)
|
|||||||
p = readline("ftp> ");
|
p = readline("ftp> ");
|
||||||
if(p == NULL)
|
if(p == NULL)
|
||||||
quit(0, 0);
|
quit(0, 0);
|
||||||
strcpy_truncate(line, p, sizeof(line));
|
strlcpy(line, p, sizeof(line));
|
||||||
add_history(p);
|
add_history(p);
|
||||||
free(p);
|
free(p);
|
||||||
} else{
|
} else{
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ guess_domain (char *hostname, size_t sz)
|
|||||||
char **aliases;
|
char **aliases;
|
||||||
|
|
||||||
if (gethostname (hostname, sz) < 0) {
|
if (gethostname (hostname, sz) < 0) {
|
||||||
strcpy_truncate (hostname, "", sz);
|
strlcpy (hostname, "", sz);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
dot = strchr (hostname, '.');
|
dot = strchr (hostname, '.');
|
||||||
@@ -90,13 +90,13 @@ guess_domain (char *hostname, size_t sz)
|
|||||||
|
|
||||||
dot = strchr (he->h_name, '.');
|
dot = strchr (he->h_name, '.');
|
||||||
if (dot != NULL) {
|
if (dot != NULL) {
|
||||||
strcpy_truncate (hostname, he->h_name, sz);
|
strlcpy (hostname, he->h_name, sz);
|
||||||
return dot + 1;
|
return dot + 1;
|
||||||
}
|
}
|
||||||
for (aliases = he->h_aliases; (a = *aliases) != NULL; ++aliases) {
|
for (aliases = he->h_aliases; (a = *aliases) != NULL; ++aliases) {
|
||||||
dot = strchr (a, '.');
|
dot = strchr (a, '.');
|
||||||
if (dot != NULL) {
|
if (dot != NULL) {
|
||||||
strcpy_truncate (hostname, a, sz);
|
strlcpy (hostname, a, sz);
|
||||||
return dot + 1;
|
return dot + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1023,7 +1023,7 @@ ftpd_getline(char *s, int n)
|
|||||||
cs = s;
|
cs = s;
|
||||||
/* tmpline may contain saved command from urgent mode interruption */
|
/* tmpline may contain saved command from urgent mode interruption */
|
||||||
if(ftp_command){
|
if(ftp_command){
|
||||||
strcpy_truncate(s, ftp_command, n);
|
strlcpy(s, ftp_command, n);
|
||||||
if (debug)
|
if (debug)
|
||||||
syslog(LOG_DEBUG, "command: %s", s);
|
syslog(LOG_DEBUG, "command: %s", s);
|
||||||
#ifdef XXX
|
#ifdef XXX
|
||||||
@@ -1362,7 +1362,7 @@ help(struct tab *ctab, char *s)
|
|||||||
columns = 1;
|
columns = 1;
|
||||||
lines = (NCMDS + columns - 1) / columns;
|
lines = (NCMDS + columns - 1) / columns;
|
||||||
for (i = 0; i < lines; i++) {
|
for (i = 0; i < lines; i++) {
|
||||||
strcpy_truncate (buf, " ", sizeof(buf));
|
strlcpy (buf, " ", sizeof(buf));
|
||||||
for (j = 0; j < columns; j++) {
|
for (j = 0; j < columns; j++) {
|
||||||
c = ctab + j * lines + i;
|
c = ctab + j * lines + i;
|
||||||
snprintf (buf + strlen(buf),
|
snprintf (buf + strlen(buf),
|
||||||
@@ -1374,7 +1374,7 @@ help(struct tab *ctab, char *s)
|
|||||||
break;
|
break;
|
||||||
w = strlen(c->name) + 1;
|
w = strlen(c->name) + 1;
|
||||||
while (w < width) {
|
while (w < width) {
|
||||||
strcat_truncate (buf,
|
strlcat (buf,
|
||||||
" ",
|
" ",
|
||||||
sizeof(buf));
|
sizeof(buf));
|
||||||
w++;
|
w++;
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ curdir(void)
|
|||||||
if (getcwd(path, sizeof(path)-1) == NULL)
|
if (getcwd(path, sizeof(path)-1) == NULL)
|
||||||
return ("");
|
return ("");
|
||||||
if (path[1] != '\0') /* special case for root dir. */
|
if (path[1] != '\0') /* special case for root dir. */
|
||||||
strcat_truncate(path, "/", sizeof(path));
|
strlcat(path, "/", sizeof(path));
|
||||||
/* For guest account, skip / since it's chrooted */
|
/* For guest account, skip / since it's chrooted */
|
||||||
return (guest ? path+1 : path);
|
return (guest ? path+1 : path);
|
||||||
}
|
}
|
||||||
@@ -526,7 +526,7 @@ user(char *name)
|
|||||||
if (inet_ntop (his_addr->sa_family,
|
if (inet_ntop (his_addr->sa_family,
|
||||||
socket_get_address(his_addr),
|
socket_get_address(his_addr),
|
||||||
data_addr, sizeof(data_addr)) == NULL)
|
data_addr, sizeof(data_addr)) == NULL)
|
||||||
strcpy_truncate (data_addr, "unknown address",
|
strlcpy (data_addr, "unknown address",
|
||||||
sizeof(data_addr));
|
sizeof(data_addr));
|
||||||
|
|
||||||
syslog(LOG_NOTICE,
|
syslog(LOG_NOTICE,
|
||||||
@@ -556,7 +556,7 @@ user(char *name)
|
|||||||
socket_get_address(his_addr),
|
socket_get_address(his_addr),
|
||||||
data_addr,
|
data_addr,
|
||||||
sizeof(data_addr)) == NULL)
|
sizeof(data_addr)) == NULL)
|
||||||
strcpy_truncate (data_addr,
|
strlcpy (data_addr,
|
||||||
"unknown address",
|
"unknown address",
|
||||||
sizeof(data_addr));
|
sizeof(data_addr));
|
||||||
|
|
||||||
@@ -571,7 +571,7 @@ user(char *name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (logging)
|
if (logging)
|
||||||
strcpy_truncate(curname, name, sizeof(curname));
|
strlcpy(curname, name, sizeof(curname));
|
||||||
if(sec_complete) {
|
if(sec_complete) {
|
||||||
if(sec_userok(name) == 0)
|
if(sec_userok(name) == 0)
|
||||||
do_login(232, name);
|
do_login(232, name);
|
||||||
@@ -786,7 +786,7 @@ int do_login(int code, char *passwd)
|
|||||||
if (inet_ntop (his_addr->sa_family,
|
if (inet_ntop (his_addr->sa_family,
|
||||||
socket_get_address(his_addr),
|
socket_get_address(his_addr),
|
||||||
data_addr, sizeof(data_addr)) == NULL)
|
data_addr, sizeof(data_addr)) == NULL)
|
||||||
strcpy_truncate (data_addr, "unknown address",
|
strlcpy (data_addr, "unknown address",
|
||||||
sizeof(data_addr));
|
sizeof(data_addr));
|
||||||
|
|
||||||
syslog(LOG_INFO, "ANONYMOUS FTP LOGIN FROM %s(%s), %s",
|
syslog(LOG_INFO, "ANONYMOUS FTP LOGIN FROM %s(%s), %s",
|
||||||
@@ -807,7 +807,7 @@ int do_login(int code, char *passwd)
|
|||||||
if (inet_ntop (his_addr->sa_family,
|
if (inet_ntop (his_addr->sa_family,
|
||||||
socket_get_address(his_addr),
|
socket_get_address(his_addr),
|
||||||
data_addr, sizeof(data_addr)) == NULL)
|
data_addr, sizeof(data_addr)) == NULL)
|
||||||
strcpy_truncate (data_addr, "unknown address",
|
strlcpy (data_addr, "unknown address",
|
||||||
sizeof(data_addr));
|
sizeof(data_addr));
|
||||||
|
|
||||||
syslog(LOG_INFO, "FTP LOGIN FROM %s(%s) as %s",
|
syslog(LOG_INFO, "FTP LOGIN FROM %s(%s) as %s",
|
||||||
@@ -898,7 +898,7 @@ pass(char *passwd)
|
|||||||
if (inet_ntop (his_addr->sa_family,
|
if (inet_ntop (his_addr->sa_family,
|
||||||
socket_get_address(his_addr),
|
socket_get_address(his_addr),
|
||||||
data_addr, sizeof(data_addr)) == NULL)
|
data_addr, sizeof(data_addr)) == NULL)
|
||||||
strcpy_truncate (data_addr, "unknown address",
|
strlcpy (data_addr, "unknown address",
|
||||||
sizeof(data_addr));
|
sizeof(data_addr));
|
||||||
|
|
||||||
reply(530, "Login incorrect.");
|
reply(530, "Login incorrect.");
|
||||||
@@ -1242,7 +1242,7 @@ dataconn(char *name, off_t size, char *mode)
|
|||||||
if (inet_ntop (data_source->sa_family,
|
if (inet_ntop (data_source->sa_family,
|
||||||
socket_get_address(data_source),
|
socket_get_address(data_source),
|
||||||
data_addr, sizeof(data_addr)) == NULL)
|
data_addr, sizeof(data_addr)) == NULL)
|
||||||
strcpy_truncate (data_addr, "unknown address",
|
strlcpy (data_addr, "unknown address",
|
||||||
sizeof(data_addr));
|
sizeof(data_addr));
|
||||||
|
|
||||||
reply(425, "Can't create data socket (%s,%d): %s.",
|
reply(425, "Can't create data socket (%s,%d): %s.",
|
||||||
@@ -1781,7 +1781,7 @@ dolog(struct sockaddr *sa)
|
|||||||
if (inet_ntop (his_addr->sa_family,
|
if (inet_ntop (his_addr->sa_family,
|
||||||
socket_get_address(his_addr),
|
socket_get_address(his_addr),
|
||||||
data_addr, sizeof(data_addr)) == NULL)
|
data_addr, sizeof(data_addr)) == NULL)
|
||||||
strcpy_truncate (data_addr, "unknown address",
|
strlcpy (data_addr, "unknown address",
|
||||||
sizeof(data_addr));
|
sizeof(data_addr));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ store_ticket(KTEXT cip)
|
|||||||
return(INTK_BADPW);
|
return(INTK_BADPW);
|
||||||
|
|
||||||
/* extract server's name */
|
/* extract server's name */
|
||||||
strcpy_truncate(sp.name, ptr, sizeof(sp.name));
|
strlcpy(sp.name, ptr, sizeof(sp.name));
|
||||||
ptr += len + 1;
|
ptr += len + 1;
|
||||||
left -= len + 1;
|
left -= len + 1;
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ store_ticket(KTEXT cip)
|
|||||||
return(INTK_BADPW);
|
return(INTK_BADPW);
|
||||||
|
|
||||||
/* extract server's instance */
|
/* extract server's instance */
|
||||||
strcpy_truncate(sp.instance, ptr, sizeof(sp.instance));
|
strlcpy(sp.instance, ptr, sizeof(sp.instance));
|
||||||
ptr += len + 1;
|
ptr += len + 1;
|
||||||
left -= len + 1;
|
left -= len + 1;
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ store_ticket(KTEXT cip)
|
|||||||
return(INTK_BADPW);
|
return(INTK_BADPW);
|
||||||
|
|
||||||
/* extract server's realm */
|
/* extract server's realm */
|
||||||
strcpy_truncate(sp.realm, ptr, sizeof(sp.realm));
|
strlcpy(sp.realm, ptr, sizeof(sp.realm));
|
||||||
ptr += len + 1;
|
ptr += len + 1;
|
||||||
left -= len + 1;
|
left -= len + 1;
|
||||||
|
|
||||||
@@ -304,12 +304,12 @@ klist(void)
|
|||||||
" Issued", " Expires", " Principal (kvno)");
|
" Issued", " Expires", " Principal (kvno)");
|
||||||
header = 0;
|
header = 0;
|
||||||
}
|
}
|
||||||
strcpy_truncate(buf1, short_date(c.issue_date), sizeof(buf1));
|
strlcpy(buf1, short_date(c.issue_date), sizeof(buf1));
|
||||||
c.issue_date = krb_life_to_time(c.issue_date, c.lifetime);
|
c.issue_date = krb_life_to_time(c.issue_date, c.lifetime);
|
||||||
if (time(0) < (unsigned long) c.issue_date)
|
if (time(0) < (unsigned long) c.issue_date)
|
||||||
strcpy_truncate(buf2, short_date(c.issue_date), sizeof(buf2));
|
strlcpy(buf2, short_date(c.issue_date), sizeof(buf2));
|
||||||
else
|
else
|
||||||
strcpy_truncate(buf2, ">>> Expired <<< ", sizeof(buf2));
|
strlcpy(buf2, ">>> Expired <<< ", sizeof(buf2));
|
||||||
lreply(200, "%s %s %s (%d)", buf1, buf2,
|
lreply(200, "%s %s %s (%d)", buf1, buf2,
|
||||||
krb_unparse_name_long(c.service, c.instance, c.realm), c.kvno);
|
krb_unparse_name_long(c.service, c.instance, c.realm), c.kvno);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,10 +89,10 @@ ftp_rooted(const char *path)
|
|||||||
|
|
||||||
if(!home[0])
|
if(!home[0])
|
||||||
if((pwd = k_getpwnam("ftp")))
|
if((pwd = k_getpwnam("ftp")))
|
||||||
strcpy_truncate(home, pwd->pw_dir, sizeof(home));
|
strlcpy(home, pwd->pw_dir, sizeof(home));
|
||||||
snprintf(newpath, sizeof(newpath), "%s/%s", home, path);
|
snprintf(newpath, sizeof(newpath), "%s/%s", home, path);
|
||||||
if(access(newpath, X_OK))
|
if(access(newpath, X_OK))
|
||||||
strcpy_truncate(newpath, path, sizeof(newpath));
|
strlcpy(newpath, path, sizeof(newpath));
|
||||||
return newpath;
|
return newpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ create_and_write_cookie (char *xauthfile,
|
|||||||
auth.data = (char*)cookie;
|
auth.data = (char*)cookie;
|
||||||
des_rand_data (cookie, cookie_sz);
|
des_rand_data (cookie, cookie_sz);
|
||||||
|
|
||||||
strcpy_truncate(xauthfile, "/tmp/AXXXXXX", xauthfile_size);
|
strlcpy(xauthfile, "/tmp/AXXXXXX", xauthfile_size);
|
||||||
fd = mkstemp(xauthfile);
|
fd = mkstemp(xauthfile);
|
||||||
if(fd < 0) {
|
if(fd < 0) {
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ renew (int argc, char **argv, OtpAlgorithm *alg, char *user)
|
|||||||
newctx.alg = alg;
|
newctx.alg = alg;
|
||||||
newctx.user = user;
|
newctx.user = user;
|
||||||
newctx.n = atoi (argv[0]);
|
newctx.n = atoi (argv[0]);
|
||||||
strcpy_truncate (newctx.seed, argv[1], sizeof(newctx.seed));
|
strlcpy (newctx.seed, argv[1], sizeof(newctx.seed));
|
||||||
strlwr(newctx.seed);
|
strlwr(newctx.seed);
|
||||||
snprintf (prompt, sizeof(prompt),
|
snprintf (prompt, sizeof(prompt),
|
||||||
"[ otp-%s %u %s ]",
|
"[ otp-%s %u %s ]",
|
||||||
@@ -155,7 +155,7 @@ set (int argc, char **argv, OtpAlgorithm *alg, char *user)
|
|||||||
err (1, "out of memory");
|
err (1, "out of memory");
|
||||||
|
|
||||||
ctx.n = atoi (argv[0]);
|
ctx.n = atoi (argv[0]);
|
||||||
strcpy_truncate (ctx.seed, argv[1], sizeof(ctx.seed));
|
strlcpy (ctx.seed, argv[1], sizeof(ctx.seed));
|
||||||
strlwr(ctx.seed);
|
strlwr(ctx.seed);
|
||||||
do {
|
do {
|
||||||
if (des_read_pw_string (pw, sizeof(pw), "Pass-phrase: ", 1))
|
if (des_read_pw_string (pw, sizeof(pw), "Pass-phrase: ", 1))
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ loop(int s)
|
|||||||
if(FD_ISSET(0, &fds)){
|
if(FD_ISSET(0, &fds)){
|
||||||
fgets(cmd, sizeof(cmd), stdin);
|
fgets(cmd, sizeof(cmd), stdin);
|
||||||
cmd[strlen(cmd) - 1] = '\0';
|
cmd[strlen(cmd) - 1] = '\0';
|
||||||
strcat_truncate (cmd, "\r\n", sizeof(cmd));
|
strlcat (cmd, "\r\n", sizeof(cmd));
|
||||||
write(s, cmd, strlen(cmd));
|
write(s, cmd, strlen(cmd));
|
||||||
}
|
}
|
||||||
if(FD_ISSET(s, &fds)){
|
if(FD_ISSET(s, &fds)){
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ pop_dropcopy(POP *p, struct passwd *pwp)
|
|||||||
* running as root.
|
* running as root.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
strcpy_truncate(template, POP_TMPDROP, sizeof(template));
|
strlcpy(template, POP_TMPDROP, sizeof(template));
|
||||||
if ((tf_fd = mkstemp(template)) < 0 ||
|
if ((tf_fd = mkstemp(template)) < 0 ||
|
||||||
(tf = fdopen(tf_fd, "w+")) == NULL) {
|
(tf = fdopen(tf_fd, "w+")) == NULL) {
|
||||||
pop_log(p,POP_PRIORITY,
|
pop_log(p,POP_PRIORITY,
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ pop_dropinfo(POP *p)
|
|||||||
"Msg %d at offset %ld being added to list",
|
"Msg %d at offset %ld being added to list",
|
||||||
mp->number, mp->offset);
|
mp->number, mp->offset);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
}else if(in_header)
|
} else if(in_header)
|
||||||
parse_header(mp, buffer);
|
parse_header(mp, buffer);
|
||||||
blank_line = (strncmp(buffer, "\n", nchar) == 0);
|
blank_line = (strncmp(buffer, "\n", nchar) == 0);
|
||||||
if(blank_line) {
|
if(blank_line) {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ pop_get_command(POP *p, char *mp)
|
|||||||
|
|
||||||
/* Save a copy of the original client line */
|
/* Save a copy of the original client line */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if(p->debug) strcpy_truncate (buf, mp, sizeof(buf));
|
if(p->debug) strlcpy (buf, mp, sizeof(buf));
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
/* Parse the message into the parameter array */
|
/* Parse the message into the parameter array */
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ pop_init(POP *p,int argcount,char **argmessage)
|
|||||||
if (ch == NULL){
|
if (ch == NULL){
|
||||||
pop_log(p,POP_PRIORITY,
|
pop_log(p,POP_PRIORITY,
|
||||||
"Unable to get canonical name of client, err = %d",error);
|
"Unable to get canonical name of client, err = %d",error);
|
||||||
strcpy_truncate (p->client, p->ipaddr, sizeof(p->client));
|
strlcpy (p->client, p->ipaddr, sizeof(p->client));
|
||||||
}
|
}
|
||||||
/* Save the cannonical name of the client host in
|
/* Save the cannonical name of the client host in
|
||||||
the POP parameter block */
|
the POP parameter block */
|
||||||
@@ -339,12 +339,12 @@ pop_init(POP *p,int argcount,char **argmessage)
|
|||||||
pop_log(p,POP_PRIORITY,
|
pop_log(p,POP_PRIORITY,
|
||||||
"Client at \"%s\" resolves to an unknown host name \"%s\"",
|
"Client at \"%s\" resolves to an unknown host name \"%s\"",
|
||||||
p->ipaddr,ch->h_name);
|
p->ipaddr,ch->h_name);
|
||||||
strcpy_truncate (p->client, p->ipaddr, sizeof(p->client));
|
strlcpy (p->client, p->ipaddr, sizeof(p->client));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Save the host name (the previous value was
|
/* Save the host name (the previous value was
|
||||||
destroyed by gethostbyname) */
|
destroyed by gethostbyname) */
|
||||||
strcpy_truncate (p->client, ch->h_name, sizeof(p->client));
|
strlcpy (p->client, ch->h_name, sizeof(p->client));
|
||||||
|
|
||||||
/* Look for the client's IP address in the list returned
|
/* Look for the client's IP address in the list returned
|
||||||
for its name */
|
for its name */
|
||||||
@@ -358,7 +358,7 @@ pop_init(POP *p,int argcount,char **argmessage)
|
|||||||
pop_log (p,POP_PRIORITY,
|
pop_log (p,POP_PRIORITY,
|
||||||
"Client address \"%s\" not listed for its host name \"%s\"",
|
"Client address \"%s\" not listed for its host name \"%s\"",
|
||||||
p->ipaddr,ch->h_name);
|
p->ipaddr,ch->h_name);
|
||||||
strcpy_truncate (p->client, p->ipaddr, sizeof(p->client));
|
strlcpy (p->client, p->ipaddr, sizeof(p->client));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
freehostent (ch_again);
|
freehostent (ch_again);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ pop_msg(POP *p, int stat, char *format, ...)
|
|||||||
pop_log(p,POP_PRIORITY,"%s",message);
|
pop_log(p,POP_PRIORITY,"%s",message);
|
||||||
|
|
||||||
/* Append the <CR><LF> */
|
/* Append the <CR><LF> */
|
||||||
strcat_truncate(message, "\r\n", sizeof(message));
|
strlcat(message, "\r\n", sizeof(message));
|
||||||
|
|
||||||
/* Send the message to the client */
|
/* Send the message to the client */
|
||||||
fputs(message, p->output);
|
fputs(message, p->output);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ pop_user (POP *p)
|
|||||||
{
|
{
|
||||||
char ss[256];
|
char ss[256];
|
||||||
|
|
||||||
strcpy_truncate(p->user, p->pop_parm[1], sizeof(p->user));
|
strlcpy(p->user, p->pop_parm[1], sizeof(p->user));
|
||||||
|
|
||||||
#ifdef OTP
|
#ifdef OTP
|
||||||
if (otp_challenge (&p->otp_ctx, p->user, ss, sizeof(ss)) == 0) {
|
if (otp_challenge (&p->otp_ctx, p->user, ss, sizeof(ss)) == 0) {
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
1999-09-16 Assar Westerlund <assar@sics.se>
|
||||||
|
|
||||||
|
* telnet/commands.c: revert 1.54, get_default_username should DTRT
|
||||||
|
now
|
||||||
|
|
||||||
1999-09-05 Assar Westerlund <assar@sics.se>
|
1999-09-05 Assar Westerlund <assar@sics.se>
|
||||||
|
|
||||||
* telnetd/utility.c (ttloop): make it return 1 if interrupted by a
|
* telnetd/utility.c (ttloop): make it return 1 if interrupted by a
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ kerberos4_send(char *name, Authenticator *ap)
|
|||||||
|
|
||||||
memset(instance, 0, sizeof(instance));
|
memset(instance, 0, sizeof(instance));
|
||||||
|
|
||||||
strcpy_truncate (instance,
|
strlcpy (instance,
|
||||||
krb_get_phost(RemoteHostName),
|
krb_get_phost(RemoteHostName),
|
||||||
INST_SZ);
|
INST_SZ);
|
||||||
|
|
||||||
@@ -521,7 +521,7 @@ kerberos4_status(Authenticator *ap, char *name, size_t name_sz, int level)
|
|||||||
return(level);
|
return(level);
|
||||||
|
|
||||||
if (UserNameRequested && !kuserok(&adat, UserNameRequested)) {
|
if (UserNameRequested && !kuserok(&adat, UserNameRequested)) {
|
||||||
strcpy_truncate(name, UserNameRequested, name_sz);
|
strlcpy(name, UserNameRequested, name_sz);
|
||||||
return(AUTH_VALID);
|
return(AUTH_VALID);
|
||||||
} else
|
} else
|
||||||
return(AUTH_USER);
|
return(AUTH_USER);
|
||||||
@@ -540,11 +540,11 @@ kerberos4_printsub(unsigned char *data, int cnt, unsigned char *buf, int buflen)
|
|||||||
|
|
||||||
switch(data[3]) {
|
switch(data[3]) {
|
||||||
case KRB_REJECT: /* Rejected (reason might follow) */
|
case KRB_REJECT: /* Rejected (reason might follow) */
|
||||||
strcpy_truncate((char *)buf, " REJECT ", buflen);
|
strlcpy((char *)buf, " REJECT ", buflen);
|
||||||
goto common;
|
goto common;
|
||||||
|
|
||||||
case KRB_ACCEPT: /* Accepted (name might follow) */
|
case KRB_ACCEPT: /* Accepted (name might follow) */
|
||||||
strcpy_truncate((char *)buf, " ACCEPT ", buflen);
|
strlcpy((char *)buf, " ACCEPT ", buflen);
|
||||||
common:
|
common:
|
||||||
BUMP(buf, buflen);
|
BUMP(buf, buflen);
|
||||||
if (cnt <= 4)
|
if (cnt <= 4)
|
||||||
@@ -557,15 +557,15 @@ kerberos4_printsub(unsigned char *data, int cnt, unsigned char *buf, int buflen)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KRB_AUTH: /* Authentication data follows */
|
case KRB_AUTH: /* Authentication data follows */
|
||||||
strcpy_truncate((char *)buf, " AUTH", buflen);
|
strlcpy((char *)buf, " AUTH", buflen);
|
||||||
goto common2;
|
goto common2;
|
||||||
|
|
||||||
case KRB_CHALLENGE:
|
case KRB_CHALLENGE:
|
||||||
strcpy_truncate((char *)buf, " CHALLENGE", buflen);
|
strlcpy((char *)buf, " CHALLENGE", buflen);
|
||||||
goto common2;
|
goto common2;
|
||||||
|
|
||||||
case KRB_RESPONSE:
|
case KRB_RESPONSE:
|
||||||
strcpy_truncate((char *)buf, " RESPONSE", buflen);
|
strlcpy((char *)buf, " RESPONSE", buflen);
|
||||||
goto common2;
|
goto common2;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -587,7 +587,7 @@ kerberos5_status(Authenticator *ap, char *name, size_t name_sz, int level)
|
|||||||
ticket->client,
|
ticket->client,
|
||||||
UserNameRequested))
|
UserNameRequested))
|
||||||
{
|
{
|
||||||
strcpy_truncate(name, UserNameRequested, name_sz);
|
strlcpy(name, UserNameRequested, name_sz);
|
||||||
return(AUTH_VALID);
|
return(AUTH_VALID);
|
||||||
} else
|
} else
|
||||||
return(AUTH_USER);
|
return(AUTH_USER);
|
||||||
@@ -606,11 +606,11 @@ kerberos5_printsub(unsigned char *data, int cnt, unsigned char *buf, int buflen)
|
|||||||
|
|
||||||
switch(data[3]) {
|
switch(data[3]) {
|
||||||
case KRB_REJECT: /* Rejected (reason might follow) */
|
case KRB_REJECT: /* Rejected (reason might follow) */
|
||||||
strcpy_truncate((char *)buf, " REJECT ", buflen);
|
strlcpy((char *)buf, " REJECT ", buflen);
|
||||||
goto common;
|
goto common;
|
||||||
|
|
||||||
case KRB_ACCEPT: /* Accepted (name might follow) */
|
case KRB_ACCEPT: /* Accepted (name might follow) */
|
||||||
strcpy_truncate((char *)buf, " ACCEPT ", buflen);
|
strlcpy((char *)buf, " ACCEPT ", buflen);
|
||||||
common:
|
common:
|
||||||
BUMP(buf, buflen);
|
BUMP(buf, buflen);
|
||||||
if (cnt <= 4)
|
if (cnt <= 4)
|
||||||
@@ -624,24 +624,24 @@ kerberos5_printsub(unsigned char *data, int cnt, unsigned char *buf, int buflen)
|
|||||||
|
|
||||||
|
|
||||||
case KRB_AUTH: /* Authentication data follows */
|
case KRB_AUTH: /* Authentication data follows */
|
||||||
strcpy_truncate((char *)buf, " AUTH", buflen);
|
strlcpy((char *)buf, " AUTH", buflen);
|
||||||
goto common2;
|
goto common2;
|
||||||
|
|
||||||
case KRB_RESPONSE:
|
case KRB_RESPONSE:
|
||||||
strcpy_truncate((char *)buf, " RESPONSE", buflen);
|
strlcpy((char *)buf, " RESPONSE", buflen);
|
||||||
goto common2;
|
goto common2;
|
||||||
|
|
||||||
case KRB_FORWARD: /* Forwarded credentials follow */
|
case KRB_FORWARD: /* Forwarded credentials follow */
|
||||||
strcpy_truncate((char *)buf, " FORWARD", buflen);
|
strlcpy((char *)buf, " FORWARD", buflen);
|
||||||
goto common2;
|
goto common2;
|
||||||
|
|
||||||
case KRB_FORWARD_ACCEPT: /* Forwarded credentials accepted */
|
case KRB_FORWARD_ACCEPT: /* Forwarded credentials accepted */
|
||||||
strcpy_truncate((char *)buf, " FORWARD_ACCEPT", buflen);
|
strlcpy((char *)buf, " FORWARD_ACCEPT", buflen);
|
||||||
goto common2;
|
goto common2;
|
||||||
|
|
||||||
case KRB_FORWARD_REJECT: /* Forwarded credentials rejected */
|
case KRB_FORWARD_REJECT: /* Forwarded credentials rejected */
|
||||||
/* (reason might follow) */
|
/* (reason might follow) */
|
||||||
strcpy_truncate((char *)buf, " FORWARD_REJECT", buflen);
|
strlcpy((char *)buf, " FORWARD_REJECT", buflen);
|
||||||
goto common2;
|
goto common2;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ krb4encpwd_reply(ap, data, cnt)
|
|||||||
des_read_pw_string(user_passwd, sizeof(user_passwd)-1, "Password: ", 0);
|
des_read_pw_string(user_passwd, sizeof(user_passwd)-1, "Password: ", 0);
|
||||||
UserPassword = user_passwd;
|
UserPassword = user_passwd;
|
||||||
Challenge = challenge;
|
Challenge = challenge;
|
||||||
strcpy_truncate(instance, RemoteHostName, sizeof(instance));
|
strlcpy(instance, RemoteHostName, sizeof(instance));
|
||||||
if ((cp = strchr(instance, '.')) != 0) *cp = '\0';
|
if ((cp = strchr(instance, '.')) != 0) *cp = '\0';
|
||||||
|
|
||||||
if (r = krb_mk_encpwd_req(&krb_token, KRB_SERVICE_NAME, instance, realm, Challenge, UserNameRequested, user_passwd)) {
|
if (r = krb_mk_encpwd_req(&krb_token, KRB_SERVICE_NAME, instance, realm, Challenge, UserNameRequested, user_passwd)) {
|
||||||
@@ -338,7 +338,7 @@ krb4encpwd_status(ap, name, name_sz, level)
|
|||||||
return(level);
|
return(level);
|
||||||
|
|
||||||
if (UserNameRequested && passwdok(UserNameRequested, UserPassword)) {
|
if (UserNameRequested && passwdok(UserNameRequested, UserPassword)) {
|
||||||
strcpy_truncate(name, UserNameRequested, name_sz);
|
strlcpy(name, UserNameRequested, name_sz);
|
||||||
return(AUTH_VALID);
|
return(AUTH_VALID);
|
||||||
} else {
|
} else {
|
||||||
return(AUTH_USER);
|
return(AUTH_USER);
|
||||||
@@ -360,11 +360,11 @@ krb4encpwd_printsub(data, cnt, buf, buflen)
|
|||||||
|
|
||||||
switch(data[3]) {
|
switch(data[3]) {
|
||||||
case KRB4_ENCPWD_REJECT: /* Rejected (reason might follow) */
|
case KRB4_ENCPWD_REJECT: /* Rejected (reason might follow) */
|
||||||
strcpy_truncate((char *)buf, " REJECT ", buflen);
|
strlcpy((char *)buf, " REJECT ", buflen);
|
||||||
goto common;
|
goto common;
|
||||||
|
|
||||||
case KRB4_ENCPWD_ACCEPT: /* Accepted (name might follow) */
|
case KRB4_ENCPWD_ACCEPT: /* Accepted (name might follow) */
|
||||||
strcpy_truncate((char *)buf, " ACCEPT ", buflen);
|
strlcpy((char *)buf, " ACCEPT ", buflen);
|
||||||
common:
|
common:
|
||||||
BUMP(buf, buflen);
|
BUMP(buf, buflen);
|
||||||
if (cnt <= 4)
|
if (cnt <= 4)
|
||||||
@@ -377,15 +377,15 @@ krb4encpwd_printsub(data, cnt, buf, buflen)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KRB4_ENCPWD_AUTH: /* Authentication data follows */
|
case KRB4_ENCPWD_AUTH: /* Authentication data follows */
|
||||||
strcpy_truncate((char *)buf, " AUTH", buflen);
|
strlcpy((char *)buf, " AUTH", buflen);
|
||||||
goto common2;
|
goto common2;
|
||||||
|
|
||||||
case KRB4_ENCPWD_CHALLENGE:
|
case KRB4_ENCPWD_CHALLENGE:
|
||||||
strcpy_truncate((char *)buf, " CHALLENGE", buflen);
|
strlcpy((char *)buf, " CHALLENGE", buflen);
|
||||||
goto common2;
|
goto common2;
|
||||||
|
|
||||||
case KRB4_ENCPWD_ACK:
|
case KRB4_ENCPWD_ACK:
|
||||||
strcpy_truncate((char *)buf, " ACK", buflen);
|
strlcpy((char *)buf, " ACK", buflen);
|
||||||
goto common2;
|
goto common2;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ rsaencpwd_is(ap, data, cnt)
|
|||||||
snprintf(challenge, sizeof(challenge), "%x", now);
|
snprintf(challenge, sizeof(challenge), "%x", now);
|
||||||
challenge_len = strlen(challenge);
|
challenge_len = strlen(challenge);
|
||||||
} else {
|
} else {
|
||||||
strcpy_truncate(challenge, "randchal", sizeof(challenge));
|
strlcpy(challenge, "randchal", sizeof(challenge));
|
||||||
challenge_len = 8;
|
challenge_len = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,7 +392,7 @@ rsaencpwd_status(ap, name, name_sz, level)
|
|||||||
return(level);
|
return(level);
|
||||||
|
|
||||||
if (UserNameRequested && rsaencpwd_passwdok(UserNameRequested, UserPassword)) {
|
if (UserNameRequested && rsaencpwd_passwdok(UserNameRequested, UserPassword)) {
|
||||||
strcpy_truncate(name, UserNameRequested, name_sz);
|
strlcpy(name, UserNameRequested, name_sz);
|
||||||
return(AUTH_VALID);
|
return(AUTH_VALID);
|
||||||
} else {
|
} else {
|
||||||
return(AUTH_USER);
|
return(AUTH_USER);
|
||||||
@@ -414,11 +414,11 @@ rsaencpwd_printsub(data, cnt, buf, buflen)
|
|||||||
|
|
||||||
switch(data[3]) {
|
switch(data[3]) {
|
||||||
case RSA_ENCPWD_REJECT: /* Rejected (reason might follow) */
|
case RSA_ENCPWD_REJECT: /* Rejected (reason might follow) */
|
||||||
strcpy_truncate((char *)buf, " REJECT ", buflen);
|
strlcpy((char *)buf, " REJECT ", buflen);
|
||||||
goto common;
|
goto common;
|
||||||
|
|
||||||
case RSA_ENCPWD_ACCEPT: /* Accepted (name might follow) */
|
case RSA_ENCPWD_ACCEPT: /* Accepted (name might follow) */
|
||||||
strcpy_truncate((char *)buf, " ACCEPT ", buflen);
|
strlcpy((char *)buf, " ACCEPT ", buflen);
|
||||||
common:
|
common:
|
||||||
BUMP(buf, buflen);
|
BUMP(buf, buflen);
|
||||||
if (cnt <= 4)
|
if (cnt <= 4)
|
||||||
@@ -431,11 +431,11 @@ rsaencpwd_printsub(data, cnt, buf, buflen)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RSA_ENCPWD_AUTH: /* Authentication data follows */
|
case RSA_ENCPWD_AUTH: /* Authentication data follows */
|
||||||
strcpy_truncate((char *)buf, " AUTH", buflen);
|
strlcpy((char *)buf, " AUTH", buflen);
|
||||||
goto common2;
|
goto common2;
|
||||||
|
|
||||||
case RSA_ENCPWD_CHALLENGEKEY:
|
case RSA_ENCPWD_CHALLENGEKEY:
|
||||||
strcpy_truncate((char *)buf, " CHALLENGEKEY", buflen);
|
strlcpy((char *)buf, " CHALLENGEKEY", buflen);
|
||||||
goto common2;
|
goto common2;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ spx_status(ap, name, name_sz, level)
|
|||||||
&acl_file_buffer);
|
&acl_file_buffer);
|
||||||
|
|
||||||
if (major_status == GSS_S_COMPLETE) {
|
if (major_status == GSS_S_COMPLETE) {
|
||||||
strcpy_truncate(name, UserNameRequested, name_sz);
|
strlcpy(name, UserNameRequested, name_sz);
|
||||||
return(AUTH_VALID);
|
return(AUTH_VALID);
|
||||||
} else {
|
} else {
|
||||||
return(AUTH_USER);
|
return(AUTH_USER);
|
||||||
@@ -537,11 +537,11 @@ spx_printsub(data, cnt, buf, buflen)
|
|||||||
|
|
||||||
switch(data[3]) {
|
switch(data[3]) {
|
||||||
case SPX_REJECT: /* Rejected (reason might follow) */
|
case SPX_REJECT: /* Rejected (reason might follow) */
|
||||||
strcpy_truncate((char *)buf, " REJECT ", buflen);
|
strlcpy((char *)buf, " REJECT ", buflen);
|
||||||
goto common;
|
goto common;
|
||||||
|
|
||||||
case SPX_ACCEPT: /* Accepted (name might follow) */
|
case SPX_ACCEPT: /* Accepted (name might follow) */
|
||||||
strcpy_truncate((char *)buf, " ACCEPT ", buflen);
|
strlcpy((char *)buf, " ACCEPT ", buflen);
|
||||||
common:
|
common:
|
||||||
BUMP(buf, buflen);
|
BUMP(buf, buflen);
|
||||||
if (cnt <= 4)
|
if (cnt <= 4)
|
||||||
@@ -554,7 +554,7 @@ spx_printsub(data, cnt, buf, buflen)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SPX_AUTH: /* Authentication data follows */
|
case SPX_AUTH: /* Authentication data follows */
|
||||||
strcpy_truncate((char *)buf, " AUTH", buflen);
|
strlcpy((char *)buf, " AUTH", buflen);
|
||||||
goto common2;
|
goto common2;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ telnet_gets(char *prompt, char *result, int length, int echo)
|
|||||||
printf("%s", prompt);
|
printf("%s", prompt);
|
||||||
res = fgets(result, length, stdin);
|
res = fgets(result, length, stdin);
|
||||||
} else if ((res = getpass(prompt))) {
|
} else if ((res = getpass(prompt))) {
|
||||||
strcpy_truncate(result, res, length);
|
strlcpy(result, res, length);
|
||||||
res = result;
|
res = result;
|
||||||
}
|
}
|
||||||
TerminalNewMode(om);
|
TerminalNewMode(om);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ makeargv()
|
|||||||
cp = line;
|
cp = line;
|
||||||
if (*cp == '!') { /* Special case shell escape */
|
if (*cp == '!') { /* Special case shell escape */
|
||||||
/* save for shell command */
|
/* save for shell command */
|
||||||
strcpy_truncate(saveline, line, sizeof(saveline));
|
strlcpy(saveline, line, sizeof(saveline));
|
||||||
*argp++ = "!"; /* No room in string to get this */
|
*argp++ = "!"; /* No room in string to get this */
|
||||||
margc++;
|
margc++;
|
||||||
cp++;
|
cp++;
|
||||||
@@ -1583,7 +1583,7 @@ env_init(void)
|
|||||||
if (strchr(hbuf, '.') == 0) {
|
if (strchr(hbuf, '.') == 0) {
|
||||||
struct hostent *he = roken_gethostbyname(hbuf);
|
struct hostent *he = roken_gethostbyname(hbuf);
|
||||||
if (he != NULL)
|
if (he != NULL)
|
||||||
strcpy_truncate(hbuf, he->h_name, 256);
|
strlcpy(hbuf, he->h_name, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
asprintf (&cp, "%s%s", hbuf, cp2);
|
asprintf (&cp, "%s%s", hbuf, cp2);
|
||||||
@@ -1981,7 +1981,7 @@ cmdrc(char *m1, char *m2)
|
|||||||
if (skiprc)
|
if (skiprc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
strcpy_truncate(m1save, m1, sizeof(m1save));
|
strlcpy(m1save, m1, sizeof(m1save));
|
||||||
m1 = m1save;
|
m1 = m1save;
|
||||||
|
|
||||||
if (rcname[0] == 0) {
|
if (rcname[0] == 0) {
|
||||||
@@ -2075,7 +2075,7 @@ tn(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
strcpy_truncate(line, "open ", sizeof(line));
|
strlcpy(line, "open ", sizeof(line));
|
||||||
printf("(to) ");
|
printf("(to) ");
|
||||||
fgets(&line[strlen(line)], sizeof(line) - strlen(line), stdin);
|
fgets(&line[strlen(line)], sizeof(line) - strlen(line), stdin);
|
||||||
makeargv();
|
makeargv();
|
||||||
@@ -2146,7 +2146,7 @@ tn(int argc, char **argv)
|
|||||||
sin6.sin6_family = family = AF_INET6;
|
sin6.sin6_family = family = AF_INET6;
|
||||||
sa = (struct sockaddr *)&sin6;
|
sa = (struct sockaddr *)&sin6;
|
||||||
sa_size = sizeof(sin6);
|
sa_size = sizeof(sin6);
|
||||||
strcpy_truncate(_hostname, hostp, sizeof(_hostname));
|
strlcpy(_hostname, hostp, sizeof(_hostname));
|
||||||
hostname =_hostname;
|
hostname =_hostname;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
@@ -2154,7 +2154,7 @@ tn(int argc, char **argv)
|
|||||||
sin.sin_family = family = AF_INET;
|
sin.sin_family = family = AF_INET;
|
||||||
sa = (struct sockaddr *)&sin;
|
sa = (struct sockaddr *)&sin;
|
||||||
sa_size = sizeof(sin);
|
sa_size = sizeof(sin);
|
||||||
strcpy_truncate(_hostname, hostp, sizeof(_hostname));
|
strlcpy(_hostname, hostp, sizeof(_hostname));
|
||||||
hostname = _hostname;
|
hostname = _hostname;
|
||||||
} else {
|
} else {
|
||||||
#ifdef HAVE_GETHOSTBYNAME2
|
#ifdef HAVE_GETHOSTBYNAME2
|
||||||
@@ -2167,7 +2167,7 @@ tn(int argc, char **argv)
|
|||||||
host = roken_gethostbyname(hostp);
|
host = roken_gethostbyname(hostp);
|
||||||
#endif
|
#endif
|
||||||
if (host) {
|
if (host) {
|
||||||
strcpy_truncate(_hostname, host->h_name, sizeof(_hostname));
|
strlcpy(_hostname, host->h_name, sizeof(_hostname));
|
||||||
family = host->h_addrtype;
|
family = host->h_addrtype;
|
||||||
addr_list = host->h_addr_list;
|
addr_list = host->h_addr_list;
|
||||||
|
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ main(int argc, char **argv)
|
|||||||
extern char *dest_realm, dst_realm_buf[];
|
extern char *dest_realm, dst_realm_buf[];
|
||||||
extern int dst_realm_sz;
|
extern int dst_realm_sz;
|
||||||
dest_realm = dst_realm_buf;
|
dest_realm = dst_realm_buf;
|
||||||
strcpy_truncate(dest_realm, optarg, dst_realm_sz);
|
strlcpy(dest_realm, optarg, dst_realm_sz);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
|||||||
@@ -82,13 +82,13 @@ SetNetTrace(char *file)
|
|||||||
if (file && (strcmp(file, "-") != 0)) {
|
if (file && (strcmp(file, "-") != 0)) {
|
||||||
NetTrace = fopen(file, "w");
|
NetTrace = fopen(file, "w");
|
||||||
if (NetTrace) {
|
if (NetTrace) {
|
||||||
strcpy_truncate(NetTraceFile, file, sizeof(NetTraceFile));
|
strlcpy(NetTraceFile, file, sizeof(NetTraceFile));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "Cannot open %s.\n", file);
|
fprintf(stderr, "Cannot open %s.\n", file);
|
||||||
}
|
}
|
||||||
NetTrace = stdout;
|
NetTrace = stdout;
|
||||||
strcpy_truncate(NetTraceFile, "(standard output)", sizeof(NetTraceFile));
|
strlcpy(NetTraceFile, "(standard output)", sizeof(NetTraceFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ int getpty(int *ptynum)
|
|||||||
p = _getpty(&master, O_RDWR, 0600, 1);
|
p = _getpty(&master, O_RDWR, 0600, 1);
|
||||||
if(p == NULL)
|
if(p == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
strcpy_truncate(line, p, sizeof(Xline));
|
strlcpy(line, p, sizeof(Xline));
|
||||||
return master;
|
return master;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -420,7 +420,7 @@ int getpty(int *ptynum)
|
|||||||
#ifdef HAVE_UNLOCKPT
|
#ifdef HAVE_UNLOCKPT
|
||||||
unlockpt(p);
|
unlockpt(p);
|
||||||
#endif
|
#endif
|
||||||
strcpy_truncate(line, ptsname(p), sizeof(Xline));
|
strlcpy(line, ptsname(p), sizeof(Xline));
|
||||||
really_stream = 1;
|
really_stream = 1;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -594,12 +594,12 @@ getterminaltype(char *name, size_t name_sz)
|
|||||||
* we have to just go with what we (might) have already gotten.
|
* we have to just go with what we (might) have already gotten.
|
||||||
*/
|
*/
|
||||||
if (his_state_is_will(TELOPT_TTYPE) && !terminaltypeok(terminaltype)) {
|
if (his_state_is_will(TELOPT_TTYPE) && !terminaltypeok(terminaltype)) {
|
||||||
strcpy_truncate(first, terminaltype, sizeof(first));
|
strlcpy(first, terminaltype, sizeof(first));
|
||||||
for(;;) {
|
for(;;) {
|
||||||
/*
|
/*
|
||||||
* Save the unknown name, and request the next name.
|
* Save the unknown name, and request the next name.
|
||||||
*/
|
*/
|
||||||
strcpy_truncate(last, terminaltype, sizeof(last));
|
strlcpy(last, terminaltype, sizeof(last));
|
||||||
_gettermname();
|
_gettermname();
|
||||||
if (terminaltypeok(terminaltype))
|
if (terminaltypeok(terminaltype))
|
||||||
break;
|
break;
|
||||||
@@ -731,7 +731,7 @@ Please contact your net administrator");
|
|||||||
|
|
||||||
tmp = inet_ntop(af, addr, host_addr, sizeof(host_addr));
|
tmp = inet_ntop(af, addr, host_addr, sizeof(host_addr));
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
strcpy_truncate (host_addr, "unknown address", sizeof(host_addr));
|
strlcpy (host_addr, "unknown address", sizeof(host_addr));
|
||||||
|
|
||||||
if (host == NULL)
|
if (host == NULL)
|
||||||
host = host_addr;
|
host = host_addr;
|
||||||
@@ -740,7 +740,7 @@ Please contact your net administrator");
|
|||||||
* We must make a copy because Kerberos is probably going
|
* We must make a copy because Kerberos is probably going
|
||||||
* to also do a gethost* and overwrite the static data...
|
* to also do a gethost* and overwrite the static data...
|
||||||
*/
|
*/
|
||||||
strcpy_truncate(remote_host_name, host, sizeof(remote_host_name));
|
strlcpy(remote_host_name, host, sizeof(remote_host_name));
|
||||||
if (hp != NULL)
|
if (hp != NULL)
|
||||||
freehostent (hp);
|
freehostent (hp);
|
||||||
host = remote_host_name;
|
host = remote_host_name;
|
||||||
@@ -762,7 +762,7 @@ Please contact your net administrator");
|
|||||||
* If hostname still doesn't fit utmp, use ipaddr.
|
* If hostname still doesn't fit utmp, use ipaddr.
|
||||||
*/
|
*/
|
||||||
if (strlen(remote_host_name) > abs(utmp_len))
|
if (strlen(remote_host_name) > abs(utmp_len))
|
||||||
strcpy_truncate(remote_host_name,
|
strlcpy(remote_host_name,
|
||||||
host_addr,
|
host_addr,
|
||||||
sizeof(remote_host_name));
|
sizeof(remote_host_name));
|
||||||
|
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ void edithost(char *pat, char *host)
|
|||||||
pat++;
|
pat++;
|
||||||
}
|
}
|
||||||
if (*host)
|
if (*host)
|
||||||
strcpy_truncate (res, host,
|
strlcpy (res, host,
|
||||||
sizeof editedhost - (res - editedhost));
|
sizeof editedhost - (res - editedhost));
|
||||||
else
|
else
|
||||||
*res = '\0';
|
*res = '\0';
|
||||||
|
|||||||
@@ -251,8 +251,8 @@ init_words (int argc, char **argv)
|
|||||||
errx (1, "cannot allocate memory for message");
|
errx (1, "cannot allocate memory for message");
|
||||||
appres.text[0] = 0;
|
appres.text[0] = 0;
|
||||||
for(; i < j; i++){
|
for(; i < j; i++){
|
||||||
strcat_truncate(appres.text, argv[i], len);
|
strlcat(appres.text, argv[i], len);
|
||||||
strcat_truncate(appres.text, " ", len);
|
strlcat(appres.text, " ", len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -799,7 +799,7 @@ talk(int force_erase)
|
|||||||
XSetForeground(dpy, gc, White);
|
XSetForeground(dpy, gc, White);
|
||||||
talking = 1;
|
talking = 1;
|
||||||
walk(FRONT);
|
walk(FRONT);
|
||||||
strcpy_truncate (buf, words, sizeof(buf));
|
strlcpy (buf, words, sizeof(buf));
|
||||||
p = buf;
|
p = buf;
|
||||||
|
|
||||||
/* possibly avoid a lot of work here
|
/* possibly avoid a lot of work here
|
||||||
@@ -834,7 +834,7 @@ talk(int force_erase)
|
|||||||
if ((w = XTextWidth(font, p, p2 - p)) > width)
|
if ((w = XTextWidth(font, p, p2 - p)) > width)
|
||||||
width = w;
|
width = w;
|
||||||
total += p2 - p; /* total chars; count to determine reading time */
|
total += p2 - p; /* total chars; count to determine reading time */
|
||||||
strcpy_truncate(args[height], p, sizeof(args[height]));
|
strlcpy(args[height], p, sizeof(args[height]));
|
||||||
if (height == MAXLINES - 1) {
|
if (height == MAXLINES - 1) {
|
||||||
puts("Message too long!");
|
puts("Message too long!");
|
||||||
break;
|
break;
|
||||||
@@ -929,14 +929,14 @@ main (int argc, char **argv)
|
|||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
if (!(pw = k_getpwuid(0)))
|
if (!(pw = k_getpwuid(0)))
|
||||||
errx (1, "can't get root's passwd!");
|
errx (1, "can't get root's passwd!");
|
||||||
strcpy_truncate(root_cpass, pw->pw_passwd, sizeof(root_cpass));
|
strlcpy(root_cpass, pw->pw_passwd, sizeof(root_cpass));
|
||||||
|
|
||||||
if (!(pw = k_getpwuid(getuid())))
|
if (!(pw = k_getpwuid(getuid())))
|
||||||
errx (1, "Can't get your password entry!");
|
errx (1, "Can't get your password entry!");
|
||||||
strcpy_truncate(user_cpass, pw->pw_passwd, sizeof(user_cpass));
|
strlcpy(user_cpass, pw->pw_passwd, sizeof(user_cpass));
|
||||||
setuid(getuid());
|
setuid(getuid());
|
||||||
/* Now we're no longer running setuid root. */
|
/* Now we're no longer running setuid root. */
|
||||||
strcpy_truncate(login, pw->pw_name, sizeof(login));
|
strlcpy(login, pw->pw_name, sizeof(login));
|
||||||
}
|
}
|
||||||
|
|
||||||
srand(getpid());
|
srand(getpid());
|
||||||
|
|||||||
@@ -150,10 +150,10 @@ auth_su(pam_handle_t *pamh, int flags, char *user, struct pam_conv *conv)
|
|||||||
|
|
||||||
pw = getpwuid(getuid());
|
pw = getpwuid(getuid());
|
||||||
if(strcmp(user, "root") == 0){
|
if(strcmp(user, "root") == 0){
|
||||||
strcpy_truncate(pr.name, pw->pw_name, sizeof(pr.name));
|
strlcpy(pr.name, pw->pw_name, sizeof(pr.name));
|
||||||
strcpy_truncate(pr.instance, "root", sizeof(pr.instance));
|
strlcpy(pr.instance, "root", sizeof(pr.instance));
|
||||||
}else{
|
}else{
|
||||||
strcpy_truncate(pr.name, user, sizeof(pr.name));
|
strlcpy(pr.name, user, sizeof(pr.name));
|
||||||
pr.instance[0] = 0;
|
pr.instance[0] = 0;
|
||||||
}
|
}
|
||||||
pmsg = &msg;
|
pmsg = &msg;
|
||||||
|
|||||||
@@ -141,10 +141,10 @@ lex.c: $(srcdir)/lex.l
|
|||||||
snprintf.c:
|
snprintf.c:
|
||||||
$(LN_S) $(srcdir)/../roken/snprintf.c .
|
$(LN_S) $(srcdir)/../roken/snprintf.c .
|
||||||
|
|
||||||
strcat_truncate.c:
|
strlcat.c:
|
||||||
$(LN_S) $(srcdir)/../roken/strcat_truncate.c .
|
$(LN_S) $(srcdir)/../roken/strlcat.c .
|
||||||
|
|
||||||
strcpy_truncate.c:
|
strlcpy.c:
|
||||||
$(LN_S) $(srcdir)/../roken/strcpy_truncate.c .
|
$(LN_S) $(srcdir)/../roken/strlcpy.c .
|
||||||
|
|
||||||
.PHONY: all Wall install uninstall clean mostlyclean distclean realclean
|
.PHONY: all Wall install uninstall clean mostlyclean distclean realclean
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ pwd_dialog(char *buf, int size)
|
|||||||
switch(DialogBox(hInst,MAKEINTRESOURCE(IDD_PASSWD_DIALOG),wnd,pwd_dialog_proc))
|
switch(DialogBox(hInst,MAKEINTRESOURCE(IDD_PASSWD_DIALOG),wnd,pwd_dialog_proc))
|
||||||
{
|
{
|
||||||
case IDOK:
|
case IDOK:
|
||||||
strcpy_truncate(buf, passwd, size);
|
strlcpy(buf, passwd, size);
|
||||||
memset (passwd, 0, sizeof(passwd));
|
memset (passwd, 0, sizeof(passwd));
|
||||||
return 0;
|
return 0;
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ LIB = $(LIBNAME).$(LIBEXT) $(AFS_EXTRA_LIBS)
|
|||||||
|
|
||||||
SOURCES = afssys.c afskrb.c common.c afslib.c
|
SOURCES = afssys.c afskrb.c common.c afslib.c
|
||||||
|
|
||||||
EXTRA_SOURCE = issuid.c strcpy_truncate.c strcat_truncate.c
|
EXTRA_SOURCE = issuid.c strlcpy.c strlcat.c
|
||||||
|
|
||||||
EXTRA_OBJECT = issuid.o strcpy_truncate.o strcat_truncate.o
|
EXTRA_OBJECT = issuid.o strlcpy.o strlcat.o
|
||||||
|
|
||||||
OBJECTS = afssys.o afskrb.o common.o $(EXTRA_OBJECT) $(AFS_EXTRA_OBJS)
|
OBJECTS = afssys.o afskrb.o common.o $(EXTRA_OBJECT) $(AFS_EXTRA_OBJS)
|
||||||
|
|
||||||
@@ -109,9 +109,9 @@ roken_rename.h:
|
|||||||
issuid.c:
|
issuid.c:
|
||||||
$(LN_S) $(srcdir)/../roken/issuid.c .
|
$(LN_S) $(srcdir)/../roken/issuid.c .
|
||||||
|
|
||||||
strcat_truncate.c:
|
strlcat.c:
|
||||||
$(LN_S) $(srcdir)/../roken/strcat_truncate.c .
|
$(LN_S) $(srcdir)/../roken/strlcat.c .
|
||||||
|
|
||||||
strcpy_truncate.c:
|
strlcpy.c:
|
||||||
$(LN_S) $(srcdir)/../roken/strcpy_truncate.c .
|
$(LN_S) $(srcdir)/../roken/strlcpy.c .
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ try_aix(void)
|
|||||||
* If we are root or running setuid don't trust AFSLIBPATH!
|
* If we are root or running setuid don't trust AFSLIBPATH!
|
||||||
*/
|
*/
|
||||||
if (getuid() != 0 && !issuid() && (p = getenv("AFSLIBPATH")) != NULL)
|
if (getuid() != 0 && !issuid() && (p = getenv("AFSLIBPATH")) != NULL)
|
||||||
strcpy_truncate(path, p, sizeof(path));
|
strlcpy(path, p, sizeof(path));
|
||||||
else
|
else
|
||||||
snprintf(path, sizeof(path), "%s/afslib.so", LIBDIR);
|
snprintf(path, sizeof(path), "%s/afslib.so", LIBDIR);
|
||||||
|
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ dns_find_cell(const char *cell, char *dbserver, size_t len)
|
|||||||
struct resource_record *rr = r->head;
|
struct resource_record *rr = r->head;
|
||||||
while(rr){
|
while(rr){
|
||||||
if(rr->type == T_AFSDB && rr->u.afsdb->preference == 1){
|
if(rr->type == T_AFSDB && rr->u.afsdb->preference == 1){
|
||||||
strcpy_truncate(dbserver,
|
strlcpy(dbserver,
|
||||||
rr->u.afsdb->domain,
|
rr->u.afsdb->domain,
|
||||||
len);
|
len);
|
||||||
ok = 0;
|
ok = 0;
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ void *dlopen(const char *path, int mode)
|
|||||||
if (errno == ENOEXEC) {
|
if (errno == ENOEXEC) {
|
||||||
char *tmp[BUFSIZ/sizeof(char *)];
|
char *tmp[BUFSIZ/sizeof(char *)];
|
||||||
if (loadquery(L_GETMESSAGES, tmp, sizeof(tmp)) == -1)
|
if (loadquery(L_GETMESSAGES, tmp, sizeof(tmp)) == -1)
|
||||||
strcpy_truncate(errbuf,
|
strlcpy(errbuf,
|
||||||
strerror(errno),
|
strerror(errno),
|
||||||
sizeof(errbuf));
|
sizeof(errbuf));
|
||||||
else {
|
else {
|
||||||
@@ -151,7 +151,7 @@ void *dlopen(const char *path, int mode)
|
|||||||
caterr(*p);
|
caterr(*p);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
strcat_truncate(errbuf,
|
strlcat(errbuf,
|
||||||
strerror(errno),
|
strerror(errno),
|
||||||
sizeof(errbuf));
|
sizeof(errbuf));
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -231,29 +231,29 @@ static void caterr(char *s)
|
|||||||
p++;
|
p++;
|
||||||
switch(atoi(s)) {
|
switch(atoi(s)) {
|
||||||
case L_ERROR_TOOMANY:
|
case L_ERROR_TOOMANY:
|
||||||
strcat_truncate(errbuf, "to many errors", sizeof(errbuf));
|
strlcat(errbuf, "to many errors", sizeof(errbuf));
|
||||||
break;
|
break;
|
||||||
case L_ERROR_NOLIB:
|
case L_ERROR_NOLIB:
|
||||||
strcat_truncate(errbuf, "can't load library", sizeof(errbuf));
|
strlcat(errbuf, "can't load library", sizeof(errbuf));
|
||||||
strcat_truncate(errbuf, p, sizeof(errbuf));
|
strlcat(errbuf, p, sizeof(errbuf));
|
||||||
break;
|
break;
|
||||||
case L_ERROR_UNDEF:
|
case L_ERROR_UNDEF:
|
||||||
strcat_truncate(errbuf, "can't find symbol", sizeof(errbuf));
|
strlcat(errbuf, "can't find symbol", sizeof(errbuf));
|
||||||
strcat_truncate(errbuf, p, sizeof(errbuf));
|
strlcat(errbuf, p, sizeof(errbuf));
|
||||||
break;
|
break;
|
||||||
case L_ERROR_RLDBAD:
|
case L_ERROR_RLDBAD:
|
||||||
strcat_truncate(errbuf, "bad RLD", sizeof(errbuf));
|
strlcat(errbuf, "bad RLD", sizeof(errbuf));
|
||||||
strcat_truncate(errbuf, p, sizeof(errbuf));
|
strlcat(errbuf, p, sizeof(errbuf));
|
||||||
break;
|
break;
|
||||||
case L_ERROR_FORMAT:
|
case L_ERROR_FORMAT:
|
||||||
strcat_truncate(errbuf, "bad exec format in", sizeof(errbuf));
|
strlcat(errbuf, "bad exec format in", sizeof(errbuf));
|
||||||
strcat_truncate(errbuf, p, sizeof(errbuf));
|
strlcat(errbuf, p, sizeof(errbuf));
|
||||||
break;
|
break;
|
||||||
case L_ERROR_ERRNO:
|
case L_ERROR_ERRNO:
|
||||||
strcat_truncate(errbuf, strerror(atoi(++p)), sizeof(errbuf));
|
strlcat(errbuf, strerror(atoi(++p)), sizeof(errbuf));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strcat_truncate(errbuf, s, sizeof(errbuf));
|
strlcat(errbuf, s, sizeof(errbuf));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -519,7 +519,7 @@ static int readExports(ModulePtr mp)
|
|||||||
* must copy the first SYMNMLEN chars and make
|
* must copy the first SYMNMLEN chars and make
|
||||||
* sure we have a zero byte at the end.
|
* sure we have a zero byte at the end.
|
||||||
*/
|
*/
|
||||||
strcpy_truncate (tmpsym, ls->l_name,
|
strlcpy (tmpsym, ls->l_name,
|
||||||
SYMNMLEN + 1);
|
SYMNMLEN + 1);
|
||||||
symname = tmpsym;
|
symname = tmpsym;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ otp_get_internal (void *v, OtpContext *ctx, int lockp)
|
|||||||
p += 4;
|
p += 4;
|
||||||
memcpy (ctx->key, p, OTPKEYSIZE);
|
memcpy (ctx->key, p, OTPKEYSIZE);
|
||||||
p += OTPKEYSIZE;
|
p += OTPKEYSIZE;
|
||||||
strcpy_truncate (ctx->seed, p, sizeof(ctx->seed));
|
strlcpy (ctx->seed, p, sizeof(ctx->seed));
|
||||||
if (lockp)
|
if (lockp)
|
||||||
return dbm_store (dbm, key, dat, DBM_REPLACE);
|
return dbm_store (dbm, key, dat, DBM_REPLACE);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ otp_print_hex (OtpKey key, char *str, size_t sz)
|
|||||||
void
|
void
|
||||||
otp_print_hex_extended (OtpKey key, char *str, size_t sz)
|
otp_print_hex_extended (OtpKey key, char *str, size_t sz)
|
||||||
{
|
{
|
||||||
strcpy_truncate (str, OTP_HEXPREFIX, sz);
|
strlcpy (str, OTP_HEXPREFIX, sz);
|
||||||
otp_print_hex (key,
|
otp_print_hex (key,
|
||||||
str + strlen(OTP_HEXPREFIX),
|
str + strlen(OTP_HEXPREFIX),
|
||||||
sz - strlen(OTP_HEXPREFIX));
|
sz - strlen(OTP_HEXPREFIX));
|
||||||
@@ -97,7 +97,7 @@ otp_print_hex_extended (OtpKey key, char *str, size_t sz)
|
|||||||
void
|
void
|
||||||
otp_print_stddict_extended (OtpKey key, char *str, size_t sz)
|
otp_print_stddict_extended (OtpKey key, char *str, size_t sz)
|
||||||
{
|
{
|
||||||
strcpy_truncate (str, OTP_WORDPREFIX, sz);
|
strlcpy (str, OTP_WORDPREFIX, sz);
|
||||||
otp_print_stddict (key,
|
otp_print_stddict (key,
|
||||||
str + strlen(OTP_WORDPREFIX),
|
str + strlen(OTP_WORDPREFIX),
|
||||||
sz - strlen(OTP_WORDPREFIX));
|
sz - strlen(OTP_WORDPREFIX));
|
||||||
|
|||||||
Reference in New Issue
Block a user