/*
- * $Id: auth.c,v 1.44.2.3.2.8 2003-12-12 19:16:32 didg Exp $
+ * $Id: auth.c,v 1.44.2.3.2.9 2004-02-14 00:30:50 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
if (!path || !*path || !list || (len = strlen(path)) > sizeof(name) - 2)
return -1;
- strncpy(buf, list, sizeof(buf));
+ strlcpy(buf, list, sizeof(buf));
if ((p = strtok(buf, ",")) == NULL)
return -1;
/*
- * $Id: messages.c,v 1.16.6.1.2.6 2003-11-13 00:19:45 bfernhomberg Exp $
+ * $Id: messages.c,v 1.16.6.1.2.7 2004-02-14 00:30:50 didg Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All Rights Reserved. See COPYRIGHT.
#include <stdlib.h>
#include <atalk/afp.h>
#include <atalk/dsi.h>
+#include <atalk/util.h>
#include <atalk/logger.h>
#include "globals.h"
#include "misc.h"
void setmessage(const char *message)
{
- strncpy(servermesg, message, MAXMESGSIZE);
+ strlcpy(servermesg, message, MAXMESGSIZE);
}
void readmessage(obj)
/*
- * $Id: uam.c,v 1.24.6.3 2004-01-11 12:31:12 bfernhomberg Exp $
+ * $Id: uam.c,v 1.24.6.4 2004-02-14 00:30:51 didg Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* All Rights Reserved. See COPYRIGHT.
goto uam_load_fail;
}
- strncpy(buf, name, sizeof(buf));
- buf[sizeof(buf) - 1] = '\0';
+ strlcpy(buf, name, sizeof(buf));
if ((p = strchr(buf, '.')))
*p = '\0';
if ( (strncasecmp_w((ucs2_t*)user, (ucs2_t*)username, len) == 0) ||
( strncasecmp_w ( (ucs2_t*) pwname, (ucs2_t*) username, len) == 0)) {
- strncpy(name, pwent->pw_name, len);
- name[len - 1] = '\0';
+ strlcpy(name, pwent->pw_name, len);
break;
}
}
/*
- * $Id: config.c,v 1.13.6.2 2004-01-15 06:34:15 bfernhomberg Exp $
+ * $Id: config.c,v 1.13.6.3 2004-02-14 00:30:51 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
* Check that av[ 0 ] is a valid interface.
* Not possible under sysV.
*/
- strncpy( ifr.ifr_name, argv[ 0 ], sizeof(ifr.ifr_name) );
- ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0';
+ strlcpy( ifr.ifr_name, argv[ 0 ], sizeof(ifr.ifr_name) );
/* for devices that don't support appletalk */
if ((ioctl(s, SIOCGIFADDR, &ifr) < 0) && (errno == ENODEV)) {
start = list = getifacelist();
while (list && *list) {
- strncpy(ifr.ifr_name, *list, sizeof(ifr.ifr_name));
+ strlcpy(ifr.ifr_name, *list, sizeof(ifr.ifr_name));
list++;
if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
== NULL ) {
return( NULL );
}
- strncpy( niface->i_name, name, sizeof(niface->i_name));
+ strlcpy( niface->i_name, name, sizeof(niface->i_name));
#ifdef BSD4_4
niface->i_addr.sat_len = sizeof( struct sockaddr_at );
#endif /* BSD4_4 */
/*
- * $Id: main.c,v 1.17.8.3 2004-01-21 00:20:57 lenneis Exp $
+ * $Id: main.c,v 1.17.8.4 2004-02-14 00:30:51 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
}
/* get interface config */
- strncpy(ifr.ifr_name, iname, sizeof(ifr.ifr_name));
+ strlcpy(ifr.ifr_name, iname, sizeof(ifr.ifr_name));
if (ioctl(sock, SIOCGIFFLAGS, &ifr) < 0) {
close(sock);
return (-1);
ifr.ifr_flags &= ~IFF_ALLMULTI;
/* set interface config */
- strncpy(ifr.ifr_name, iname, sizeof(ifr.ifr_name));
+ strlcpy(ifr.ifr_name, iname, sizeof(ifr.ifr_name));
if (ioctl(sock, SIOCSIFFLAGS, &ifr) < 0) {
close(sock);
return -1;
/*
- * $Id: auth.c,v 1.6.8.1 2003-11-14 14:37:38 didg Exp $
+ * $Id: auth.c,v 1.6.8.2 2004-02-14 00:30:51 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
if (!path || !list || (len = strlen(path)) > sizeof(name) - 2)
return -1;
- strncpy(buf, list, sizeof(buf));
+ strlcpy(buf, list, sizeof(buf));
if ((p = strtok(buf, ",")) == NULL)
return -1;
}
while (p) {
- strncpy(name + len, p, sizeof(name) - len);
+ strlcpy(name + len, p, sizeof(name) - len);
if ((stat(name, &st) == 0) && (mod = uam_load(name, p))) {
uam_attach(&uam_modules, mod);
LOG(log_info, logtype_papd, "uam: %s loaded", p);
/*
- * $Id: uam.c,v 1.9.6.3 2003-11-14 14:37:38 didg Exp $
+ * $Id: uam.c,v 1.9.6.4 2004-02-14 00:30:51 didg Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* All Rights Reserved. See COPYRIGHT.
goto uam_load_fail;
}
- strncpy(buf, name, sizeof(buf));
+ strlcpy(buf, name, sizeof(buf));
if ((p = strchr(buf, '.')))
*p = '\0';
if ((mod->uam_fcn = mod_symbol(module, buf)) == NULL) {
/*
- * $Id: util.h,v 1.7.10.2 2003-10-17 00:01:12 didg Exp $
+ * $Id: util.h,v 1.7.10.3 2004-02-14 00:30:52 didg Exp $
*/
#ifndef _ATALK_UTIL_H
extern void fault_setup __P((void (*fn)(void *)));
#define server_unlock(x) (unlink(x))
+#ifndef HAVE_STRLCPY
+size_t strlcpy(char *d, const char *s, size_t bufsize);
+#endif
+
+#ifndef HAVE_STRLCAT
+size_t strlcat(char *d, const char *s, size_t bufsize);
+#endif
+
#ifndef HAVE_DLFCN_H
extern void *mod_open __P((const char *));
extern void *mod_symbol __P((void *, const char *));
/*
- * $Id: dsi_tcp.c,v 1.9.10.4 2004-02-11 16:06:15 didg Exp $
+ * $Id: dsi_tcp.c,v 1.9.10.5 2004-02-14 00:30:52 didg Exp $
*
* Copyright (c) 1997, 1998 Adrian Sun (asun@zoology.washington.edu)
* All rights reserved. See COPYRIGHT.
/* get it from the interface list */
start = list = getifacelist();
while (list && *list) {
- strncpy(ifr.ifr_name, *list, sizeof(ifr.ifr_name));
- ifr.ifr_name[sizeof(ifr.ifr_name) -1] = 0;
+ strlcpy(ifr.ifr_name, *list, sizeof(ifr.ifr_name));
list++;
#ifndef IFF_SLAVE