Update to netatalk-2.0.3 and get rid of old directory structure.

A long due update with important features such as long filenames,
unicode, etc.
From new maintainer "Arnaud Bergeron" <abergeron@gmail.com>
This commit is contained in:
pvalchev 2006-09-22 05:54:33 +00:00
parent 08d93ef342
commit 69e49a8551
75 changed files with 1998 additions and 1230 deletions

View File

@ -1,5 +1,64 @@
# $OpenBSD: Makefile,v 1.18 2003/08/11 00:14:43 naddy Exp $
# $OpenBSD: Makefile,v 1.19 2006/09/22 05:54:33 pvalchev Exp $
SUBDIR+= stable
COMMENT= "AFP file and print services for AppleTalk/IP networks"
.include <bsd.port.subdir.mk>
DISTNAME= netatalk-2.0.3
CATEGORIES= net
HOMEPAGE= http://netatalk.sourceforge.net/
MAINTAINER= Arnaud Bergeron <abergeron@gmail.com>
# Mainly GPL, some parts BSD or similar
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
WANTLIB= c crypto rpcsvc
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=netatalk/}
CONFIGURE_STYLE= gnu
USE_LIBTOOL= Yes
LIB_DEPENDS= db.4::databases/db/v4
CONFIGURE_ARGS+= --with-db4=${LOCALBASE}
CONFIGURE_ARGS+= ${CONFIGURE_SHARED}
CONFIGURE_ARGS+= --with-ssl=/usr
CONFIGURE_ARGS+= --with-config-dir=${CONFDIR}
CONFIGURE_ARGS+= --with-pkgconfdir=${CONFDIR}
CONFIGURE_ARGS+= --with-uams-path=${PREFIX}/lib/netatalk/uams
CONFIGURE_ARGS+= --disable-overwrite
CONFIGURE_ARGS+= --disable-cups
post-patch:
@cp /usr/include/netatalk/*.h ${WRKSRC}/sys/netatalk
post-build:
@(cd ${WRKSRC}/distrib/initscripts; make rc.atalk.bsd)
@(cd ${WRKSRC}/config; make afpd.conf)
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/netatalk
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/netatalk
.for i in AppleVolumes.default AppleVolumes.system \
atalkd.conf papd.conf netatalk.conf afpd.conf
${INSTALL_DATA} ${WRKSRC}/config/$i \
${PREFIX}/share/examples/netatalk
.endfor
${INSTALL_DATA} ${WRKSRC}/distrib/initscripts/rc.atalk.bsd \
${PREFIX}/share/examples/netatalk
${INSTALL_DATA} ${WRKSRC}/COPYRIGHT ${WRKSRC}/COPYING\
${PREFIX}/share/doc/netatalk
.for i in FAQ README.hidden-items README.platforms README.logger \
README.ids Netatalk-Manual.txt Netatalk-Manual.pdf
${INSTALL_DATA} ${WRKSRC}/doc/$i ${PREFIX}/share/doc/netatalk
.endfor
.include <bsd.port.mk>

4
net/netatalk/distinfo Normal file
View File

@ -0,0 +1,4 @@
MD5 (netatalk-2.0.3.tar.gz) = 17917abd7d255d231cc0c6188ccd27fb
RMD160 (netatalk-2.0.3.tar.gz) = 55d120cd97a8a10f9ec112f43f9952fbaca034a3
SHA1 (netatalk-2.0.3.tar.gz) = 5f94d9691e14ccf66e37664afc73bb0c31bc8437
SIZE (netatalk-2.0.3.tar.gz) = 1920570

View File

@ -0,0 +1,65 @@
$OpenBSD: patch-bin_afile_common_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- bin/afile/common.c.orig Fri Jun 29 10:14:46 2001
+++ bin/afile/common.c Sat Dec 31 11:14:53 2005
@@ -64,22 +64,23 @@ char *dataname_to_adname(const char *dat
{
const char *filepart;
char *adname;
- size_t adlen = strlen(AD_PREFIX);
+ size_t adlen = strlen(AD_PREFIX) + strlen(dataname) + 1;
size_t dirlen;
/* Construct the AppleDouble file name from data fork file name. */
- adname = calloc(adlen + strlen(dataname) + 1, sizeof(char));
+ adname = (char *)malloc(adlen);
filepart = rindex(dataname, '/');
if (filepart == NULL) {
/* Filename doesn't contain a path. */
- strcpy(adname, AD_PREFIX);
- strcpy(adname + adlen, dataname);
+ strlcpy(adname, AD_PREFIX, adlen);
+ strlcat(adname, dataname, adlen);
} else {
/* Filename does contain a path. */
- dirlen = (size_t) (filepart - dataname);
- strncpy(adname, dataname, dirlen + 1);
- strcpy(adname + dirlen + 1, AD_PREFIX);
- strcpy(adname + dirlen + adlen + 1, filepart + 1);
+ dirlen = (filepart - dataname) + 1;
+ strncpy(adname, dataname, dirlen);
+ adname[dirlen] = '\0';
+ strlcat(adname, AD_PREFIX, adlen);
+ strlcat(adname, filepart + 1, adlen);
}
return adname;
@@ -89,20 +90,21 @@ char *adname_to_dataname(const char *adn
{
const char *filepart;
char *dataname;
- size_t plen = strlen(PARENT_PREFIX);
+ size_t datalen = strlen(adname) + strlen(PARENT_PREFIX) + 1;
size_t dirlen;
/* Construct the data file name from the AppleDouble file name. */
- dataname = calloc(strlen(adname) + plen + 1, sizeof(char));
+ dataname = (char *)malloc(datalen);
filepart = rindex(adname, '/');
if (filepart == NULL) {
- strcpy(dataname, PARENT_PREFIX);
- strcpy(dataname + plen, adname);
+ strlcpy(dataname, PARENT_PREFIX, datalen);
+ strlcat(dataname, adname, datalen);
} else {
- dirlen = (size_t) (filepart - adname);
- strncpy(dataname, adname, dirlen + 1);
- strcpy(dataname + dirlen + 1, PARENT_PREFIX);
- strcpy(dataname + dirlen + plen + 1, filepart + 1);
+ dirlen = (size_t) (filepart - adname) + 1;
+ strncpy(dataname, adname, dirlen);
+ dataname[dirlen] = '\0';
+ strlcpy(dataname, PARENT_PREFIX, datalen);
+ strlcpy(dataname, filepart + 1, datalen);
}
return dataname;

View File

@ -0,0 +1,118 @@
$OpenBSD: patch-bin_afppasswd_afppasswd_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- bin/afppasswd/afppasswd.c.orig Wed Feb 9 20:23:07 2005
+++ bin/afppasswd/afppasswd.c Fri Dec 30 22:25:07 2005
@@ -64,7 +64,7 @@
#define HEXPASSWDLEN 16
#define PASSWDLEN 8
-static char buf[MAXPATHLEN + 1];
+static char buf[MAXPATHLEN];
/* if newpwd is null, convert buf from hex to binary. if newpwd isn't
* null, convert newpwd to hex and save it in buf. */
@@ -117,7 +117,7 @@ static void convert_passwd(char *buf, ch
/* this matches the code in uam_randnum.c */
static int update_passwd(const char *path, const char *name, int flags)
{
- char password[PASSWDLEN + 1], *p, *passwd;
+ char password[PASSWDLEN], *p, *passwd;
FILE *fp;
off_t pos;
int keyfd = -1, err = 0;
@@ -128,9 +128,9 @@ static int update_passwd(const char *pat
}
/* open the key file if it exists */
- strcpy(buf, path);
+ strlcpy(buf, path, sizeof(buf));
if (strlen(path) < sizeof(buf) - 5) {
- strcat(buf, ".key");
+ strlcat(buf, ".key", sizeof(buf));
keyfd = open(buf, O_RDONLY);
}
@@ -154,8 +154,8 @@ static int update_passwd(const char *pat
}
if (flags & OPT_ADDUSER) {
- strcpy(buf, name);
- strcat(buf, FORMAT);
+ strlcpy(buf, name, sizeof(buf));
+ strlcat(buf, FORMAT, sizeof(buf));
p = strchr(buf, ':') + 1;
fwrite(buf, strlen(buf), 1, fp);
} else {
@@ -239,8 +239,8 @@ static int create_file(const char *path,
/* a little paranoia */
if (strlen(pwd->pw_name) + FORMAT_LEN > sizeof(buf) - 1)
continue;
- strcpy(buf, pwd->pw_name);
- strcat(buf, FORMAT);
+ strlcpy(buf, pwd->pw_name, sizeof(buf));
+ strlcat(buf, FORMAT, sizeof(buf));
len = strlen(buf);
if (write(fd, buf, len) != len) {
fprintf(stderr, "afppasswd: problem writing to %s: %s\n", path,
@@ -255,6 +255,22 @@ static int create_file(const char *path,
return err;
}
+void usage(void) {
+#ifdef USE_CRACKLIB
+ fprintf(stderr, "Usage: afppasswd [-acfn] [-u minuid] [-p path] [username]\n");
+#else /* USE_CRACKLIB */
+ fprintf(stderr, "Usage: afppasswd [-acf] [-u minuid] [-p path] [username]\n");
+#endif /* USE_CRACKLIB */
+ fprintf(stderr, " -a add a new user\n");
+ fprintf(stderr, " -c create and initialize password file or specific user\n");
+ fprintf(stderr, " -f force an action\n");
+#ifdef USE_CRACKLIB
+ fprintf(stderr, " -n disable cracklib checking of passwords\n");
+#endif /* USE_CRACKLIB */
+ fprintf(stderr, " -u uid minimum uid to use, defaults to 100\n");
+ fprintf(stderr, " -p path path to afppasswd file\n");
+ exit(-1);
+}
int main(int argc, char **argv)
{
@@ -270,16 +286,7 @@ int main(int argc, char **argv)
flags = ((uid = getuid()) == 0) ? OPT_ISROOT : 0;
if (((flags & OPT_ISROOT) == 0) && (argc > 1)) {
- fprintf(stderr, "Usage: afppasswd [-acfn] [-u minuid] [-p path] [username]\n");
- fprintf(stderr, " -a add a new user\n");
- fprintf(stderr, " -c create and initialize password file or specific user\n");
- fprintf(stderr, " -f force an action\n");
-#ifdef USE_CRACKLIB
- fprintf(stderr, " -n disable cracklib checking of passwords\n");
-#endif /* USE_CRACKLIB */
- fprintf(stderr, " -u uid minimum uid to use, defaults to 100\n");
- fprintf(stderr, " -p path path to afppasswd file\n");
- return -1;
+ usage();
}
while ((i = getopt(argc, argv, OPTIONS)) != EOF) {
@@ -312,20 +319,7 @@ int main(int argc, char **argv)
if (err || (optind + ((flags & OPT_CREATE) ? 0 :
(flags & OPT_ISROOT)) != argc)) {
-#ifdef USE_CRACKLIB
- fprintf(stderr, "Usage: afppasswd [-acfn] [-u minuid] [-p path] [username]\n");
-#else /* USE_CRACKLIB */
- fprintf(stderr, "Usage: afppasswd [-acf] [-u minuid] [-p path] [username]\n");
-#endif /* USE_CRACKLIB */
- fprintf(stderr, " -a add a new user\n");
- fprintf(stderr, " -c create and initialize password file or specific user\n");
- fprintf(stderr, " -f force an action\n");
-#ifdef USE_CRACKLIB
- fprintf(stderr, " -n disable cracklib checking of passwords\n");
-#endif /* USE_CRACKLIB */
- fprintf(stderr, " -u uid minimum uid to use, defaults to 100\n");
- fprintf(stderr, " -p path path to afppasswd file\n");
- return -1;
+ usage();
}
i = stat(path, &st);

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-bin_megatron_megatron_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- bin/megatron/megatron.c.orig Sun Apr 28 21:52:49 2002
+++ bin/megatron/megatron.c Fri Dec 30 22:34:51 2005
@@ -246,7 +246,7 @@ int megatron( path, module, newname, fla
*/
if (*newname)
- strcpy(fh.name, newname);
+ strlcpy(fh.name, newname, sizeof(fh.name));
if ( to_open( module, path, &fh, flags ) < 0 ) {
(void)from_close( module );
@@ -302,7 +302,7 @@ int main( argc, argv )
int converts = sizeof(name) / sizeof(char *);
int module = -1;
int flags = 0;
- char *progname, newname[ADEDLEN_NAME + 1];
+ char *progname, newname[ADEDLEN_NAME];
progname = strrchr( argv[ 0 ], '/' );
if (( progname == NULL ) || ( progname == '\0' )) {
@@ -334,7 +334,7 @@ int main( argc, argv )
continue;
}
if ( strcmp( argv [ c ], "--filename" ) == 0 ) {
- if(++c < argc) strncpy(newname,argv[c], ADEDLEN_NAME);
+ if(++c < argc) strlcpy(newname,argv[c], sizeof(newname));
continue;
}
if (strcmp(argv[c], "--stdout") == 0) {

View File

@ -0,0 +1,65 @@
$OpenBSD: patch-bin_megatron_nad_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- bin/megatron/nad.c.orig Wed Feb 9 20:23:08 2005
+++ bin/megatron/nad.c Sat Dec 31 11:43:27 2005
@@ -414,8 +414,8 @@ void select_charset( int options)
#endif /* HEXOUTPUT */
struct nad_file_data {
- char macname[ MAXPATHLEN + 1 ];
- char adpath[ 2 ][ MAXPATHLEN + 1];
+ char macname[ MAXPATHLEN];
+ char adpath[ 2 ][ MAXPATHLEN];
int offset[ NUMFORKS ];
struct adouble ad;
} nad;
@@ -451,9 +451,10 @@ int nad_open( path, openflags, fh, optio
if ( openflags == O_RDONLY ) {
initvol(path);
- strcpy( nad.adpath[0], path );
- strcpy( nad.adpath[1],
- nad.ad.ad_path( nad.adpath[0], ADFLAGS_DF|ADFLAGS_HF ));
+ strlcpy( nad.adpath[0], path, sizeof(nad.adpath[0]) );
+ strlcpy( nad.adpath[1],
+ nad.ad.ad_path( nad.adpath[0], ADFLAGS_DF|ADFLAGS_HF ),
+ sizeof(nad.adpath[1]));
for ( fork = 0 ; fork < NUMFORKS ; fork++ ) {
if ( stat( nad.adpath[ fork ], &st ) < 0 ) {
if ( errno == ENOENT ) {
@@ -478,10 +479,11 @@ int nad_open( path, openflags, fh, optio
} else {
initvol (".");
- strcpy( nad.macname, fh->name );
- strcpy( nad.adpath[0], mtoupath( nad.macname ));
- strcpy( nad.adpath[1],
- nad.ad.ad_path( nad.adpath[0], ADFLAGS_DF|ADFLAGS_HF ));
+ strlcpy( nad.macname, fh->name, sizeof(nad.macname) );
+ strlcpy( nad.adpath[0], mtoupath( nad.macname ), sizeof(nad.adpath[0]));
+ strlcpy( nad.adpath[1],
+ nad.ad.ad_path( nad.adpath[0], ADFLAGS_DF|ADFLAGS_HF ),
+ sizeof(nad.adpath[1]) );
#if DEBUG
fprintf(stderr, "%s\n", nad.macname);
fprintf(stderr, "%s is adpath[0]\n", nad.adpath[0]);
@@ -512,7 +514,7 @@ int nad_header_read( fh )
memcpy( nad.macname, ad_entry( &nad.ad, ADEID_NAME ),
ad_getentrylen( &nad.ad, ADEID_NAME ));
nad.macname[ ad_getentrylen( &nad.ad, ADEID_NAME ) ] = '\0';
- strcpy( fh->name, nad.macname );
+ strlcpy( fh->name, nad.macname, sizeof(fh->name) );
#endif
/* just in case there's nothing in macname */
@@ -521,9 +523,9 @@ int nad_header_read( fh )
p = nad.adpath[DATA];
else p++;
#if 0
- strcpy(fh->name, utompath(nad.adpath[DATA]));
+ strlcpy(fh->name, utompath(nad.adpath[DATA]), sizeof(fh->name));
#endif
- strcpy(fh->name, utompath(p));
+ strlcpy(fh->name, utompath(p), sizeof(fh->name));
}
if ( stat( nad.adpath[ DATA ], &st ) < 0 ) {

View File

@ -0,0 +1,32 @@
$OpenBSD: patch-bin_nbp_nbplkup_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- bin/nbp/nbplkup.c.orig Mon Jan 31 14:50:35 2005
+++ bin/nbp/nbplkup.c Sat Dec 31 00:15:28 2005
@@ -126,25 +126,22 @@ int main( ac, av )
exit( 1 );
}
- if (( name = (char *)malloc( strlen( Obj ) + 1 )) == NULL ) {
+ if (asprintf(&name, "%s", Obj)) {
perror( "malloc" );
exit( 1 );
}
- strcpy( name, Obj );
Obj = name;
- if (( name = (char *)malloc( strlen( Type ) + 1 )) == NULL ) {
+ if (asprintf(&name, "%s", Type)) {
perror( "malloc" );
exit( 1 );
}
- strcpy( name, Type );
Type = name;
- if (( name = (char *)malloc( strlen( Zone ) + 1 )) == NULL ) {
+ if (asprintf(&name, "%s", Zone)) {
perror( "malloc" );
exit( 1 );
}
- strcpy( name, Zone );
Zone = name;
}

View File

@ -0,0 +1,36 @@
$OpenBSD: patch-bin_psorder_psorder_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- bin/psorder/psorder.c.orig Fri Jun 29 10:14:46 2001
+++ bin/psorder/psorder.c Sat Dec 31 11:48:01 2005
@@ -151,7 +151,7 @@ filesetup( inputfile, infd, tfile, tfd )
make temporary file
*/
- (void *)strncpy( tfile, template, MAXNAMLEN );
+ (void *)strlcpy( tfile, template, MAXNAMLEN );
if (( *tfd = mkstemp( tfile )) == -1 ) {
fprintf( stderr, "can't create temporary file %s\n", tfile );
filecleanup( -1, -1, "" );
@@ -391,11 +391,12 @@ writeps( tempfd, tempfile )
} else if (( strncmp( psinfo.pages.order, "", ORDERLEN ) == 0 ) ||
( strncmp( psinfo.pages.order, "1", ORDERLEN ) == 0 )) {
order = orderflag;
- if ( order == REVERSE ) strcpy( psinfo.pages.order, "-1" );
+ if ( order == REVERSE )
+ strlcpy( psinfo.pages.order, "-1", sizeof(psinfo.pages.order) );
} else if ( strncmp( psinfo.pages.order, "-1", ORDERLEN ) == 0 ) {
if ( orderflag == FORWARD ) {
order = REVERSE;
- strcpy( psinfo.pages.order, "1" );
+ strlcpy( psinfo.pages.order, "1", sizeof(psinfo.pages.order) );
} else order = FORWARD;
} else if (( strncmp( psinfo.pages.order, "0", ORDERLEN ) == 0 ) &&
forceflag ) {
@@ -481,7 +482,7 @@ writelable( tempfd, tempfile, lable )
} else {
argone = argtwo = NULL;
}
- (void)sprintf( line, "%s %s %s", lable, argone, argtwo );
+ (void)snprintf( line, sizeof(line), "%s %s %s", lable, argone, argtwo );
linelen = strlen( line );
ccwrite = write( 1, line, linelen );

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-bin_uniconv_uniconv_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- bin/uniconv/uniconv.c.orig Sun Jul 11 20:15:18 2004
+++ bin/uniconv/uniconv.c Fri Dec 30 22:51:44 2005
@@ -105,7 +105,7 @@ static int veto(const char *path)
static int do_rename( char* src, char *dst, struct stat *st)
{
- char adsrc[ MAXPATHLEN + 1];
+ char adsrc[ MAXPATHLEN];
struct stat tmp_st;
if (!stat(dst, &tmp_st)) {
@@ -121,7 +121,7 @@ static int do_rename( char* src, char *d
if (S_ISDIR(st->st_mode))
return 0;
- strcpy( adsrc, ad_path( src, 0 ));
+ strlcpy( adsrc, ad_path( src, 0 ), sizeof(adsrc));
if (rename( adsrc, ad_path( dst, 0 )) < 0 ) {
struct stat ad_st;

View File

@ -0,0 +1,42 @@
$OpenBSD: patch-etc_afpd_auth_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/afpd/auth.c.orig Fri Mar 11 10:36:58 2005
+++ etc/afpd/auth.c Fri Dec 30 23:14:23 2005
@@ -244,7 +244,7 @@ static int login(AFPObj *obj, struct pas
int mypid = getpid();
struct stat stat_buf;
- sprintf(nodename, "%s/net%d.%dnode%d", obj->options.authprintdir,
+ snprintf(nodename, sizeof(nodename), "%s/net%d.%dnode%d", obj->options.authprintdir,
addr_net / 256, addr_net % 256, addr_node);
LOG(log_info, logtype_afpd, "registering %s (uid %d) on %u.%u as %s",
pwd->pw_name, pwd->pw_uid, addr_net, addr_node, nodename);
@@ -333,7 +333,7 @@ static int login(AFPObj *obj, struct pas
else
clientname = inet_ntoa( dsi->client.sin_addr );
- sprintf( hostname, "%s@%s", pwd->pw_name, clientname );
+ snprintf( hostname, sizeof(hostname), "%s@%s", pwd->pw_name, clientname );
if( sia_become_user( NULL, argc, argv, hostname, pwd->pw_name,
NULL, FALSE, NULL, NULL,
@@ -999,7 +999,7 @@ int auth_register(const int type, struct
/* load all of the modules */
int auth_load(const char *path, const char *list)
{
- char name[MAXPATHLEN + 1], buf[MAXPATHLEN + 1], *p;
+ char name[MAXPATHLEN], buf[MAXPATHLEN], *p;
struct uam_mod *mod;
struct stat st;
size_t len;
@@ -1011,9 +1011,9 @@ int auth_load(const char *path, const ch
if ((p = strtok(buf, ",")) == NULL)
return -1;
- strcpy(name, path);
+ strlcpy(name, path, sizeof(name));
if (name[len - 1] != '/') {
- strcat(name, "/");
+ strlcat(name, "/", sizeof(name));
len++;
}

View File

@ -0,0 +1,181 @@
$OpenBSD: patch-etc_afpd_directory_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/afpd/directory.c.orig Wed Feb 9 20:23:10 2005
+++ etc/afpd/directory.c Sat Dec 31 14:16:49 2005
@@ -681,7 +681,7 @@ int netatalk_unlink(const char *name)
/* ------------------- */
static int deletedir(char *dir)
{
- char path[MAXPATHLEN + 1];
+ char path[MAXPATHLEN];
DIR *dp;
struct dirent *de;
struct stat st;
@@ -696,8 +696,8 @@ static int deletedir(char *dir)
if ((dp = opendir(dir)) == NULL)
return AFP_OK;
- strcpy(path, dir);
- strcat(path, "/");
+ strlcpy(path, dir, sizeof(path));
+ strlcat(path, "/", sizeof(path));
len++;
remain = sizeof(path) -len -1;
while ((de = readdir(dp)) && err == AFP_OK) {
@@ -709,7 +709,7 @@ static int deletedir(char *dir)
err = AFPERR_PARAM;
break;
}
- strcpy(path + len, de->d_name);
+ strlcat(path, de->d_name, sizeof(path));
if (stat(path, &st)) {
continue;
}
@@ -732,7 +732,7 @@ static int deletedir(char *dir)
/* do a recursive copy. */
static int copydir(const struct vol *vol, char *src, char *dst)
{
- char spath[MAXPATHLEN + 1], dpath[MAXPATHLEN + 1];
+ char spath[MAXPATHLEN], dpath[MAXPATHLEN];
DIR *dp;
struct dirent *de;
struct stat st;
@@ -754,13 +754,13 @@ static int copydir(const struct vol *vol
}
/* set things up to copy */
- strcpy(spath, src);
- strcat(spath, "/");
+ strlcpy(spath, src, sizeof(spath));
+ strlcat(spath, "/", sizeof(spath));
slen++;
srem = sizeof(spath) - slen -1;
- strcpy(dpath, dst);
- strcat(dpath, "/");
+ strlcpy(dpath, dst, sizeof(dpath));
+ strlcat(dpath, "/", sizeof(dpath));
dlen++;
drem = sizeof(dpath) - dlen -1;
@@ -774,14 +774,14 @@ static int copydir(const struct vol *vol
err = AFPERR_PARAM;
break;
}
- strcpy(spath + slen, de->d_name);
+ strlcat(spath, de->d_name, sizeof(spath));
if (stat(spath, &st) == 0) {
if (strlen(de->d_name) > drem) {
err = AFPERR_PARAM;
break;
}
- strcpy(dpath + dlen, de->d_name);
+ strlcpy(dpath, de->d_name, sizeof(dpath));
if (S_ISDIR(st.st_mode)) {
if (AFP_OK != (err = copydir(vol, spath, dpath)))
@@ -969,7 +969,7 @@ struct dir *dir;
char **cpath;
{
struct dir *cdir;
- static char path[ MAXPATHLEN + 1];
+ static char path[ MAXPATHLEN ];
static struct path ret;
char *data, *p;
@@ -1045,16 +1045,13 @@ char **cpath;
if ( movecwd( vol, dir->d_parent ) < 0 ) {
return NULL;
}
- strcpy(path, dir->d_m_name);
+ strlcpy(path, dir->d_m_name, sizeof(path));
if (dir->d_m_name == dir->d_u_name) {
ret.u_name = path;
}
else {
- size_t tp = strlen(path)+1;
-
- strcpy(path +tp, dir->d_u_name);
- ret.u_name = path +tp;
-
+ ret.u_name = path + (strlen(path) + 1);
+ strlcat(path, dir->d_u_name, sizeof(path));
}
/* FIXME should we set :
ret.st_valid = 1;
@@ -1120,7 +1117,7 @@ char **cpath;
afp_errno = AFPERR_PARAM;
return( NULL );
}
- strcpy(path, temp);
+ strlcpy(path, temp, sizeof(path));
}
/* check for OS X mangled filename :( */
@@ -1132,8 +1129,8 @@ char **cpath;
*/
if ( (t = utompath(vol, ret.u_name, fileid, utf8_encoding())) ) {
/* at last got our view of mac name */
- strcpy(path,t);
- }
+ strlcpy(path, t, sizeof(path));
+ }
}
}
if ( !extend ) {
@@ -1192,7 +1189,7 @@ int movecwd( vol, dir)
const struct vol *vol;
struct dir *dir;
{
- char path[MAXPATHLEN + 1];
+ char path[MAXPATHLEN];
struct dir *d;
char *p, *u;
int n;
@@ -2111,25 +2108,25 @@ struct dir *dir, *newparent;
if (dir->d_m_name == dir->d_u_name)
dir->d_u_name = NULL;
- if ((buf = (char *) realloc( dir->d_m_name, len + 1 )) == NULL ) {
+ if ((buf = strdup(newname)) == NULL ) {
LOG(log_error, logtype_afpd, "renamedir: realloc mac name: %s", strerror(errno) );
/* FIXME : fatal ? */
return AFPERR_MISC;
}
+ free(dir->d_m_name);
dir->d_m_name = buf;
- strcpy( dir->d_m_name, newname );
if (newname == dst) {
free(dir->d_u_name);
dir->d_u_name = dir->d_m_name;
}
else {
- if ((buf = (char *) realloc( dir->d_u_name, strlen(dst) + 1 )) == NULL ) {
+ if ((buf = strdup(dst)) == NULL ) {
LOG(log_error, logtype_afpd, "renamedir: realloc unix name: %s", strerror(errno) );
return AFPERR_MISC;
}
+ free(dir->d_u_name);
dir->d_u_name = buf;
- strcpy( dir->d_u_name, dst );
}
if (( parent = dir->d_parent ) == NULL ) {
@@ -2146,7 +2143,6 @@ struct dir *dir, *newparent;
return( AFP_OK );
}
-#define DOT_APPLEDOUBLE_LEN 13
/* delete an empty directory */
int deletecurdir( vol, path, pathlen )
const struct vol *vol;
@@ -2200,7 +2196,7 @@ int pathlen;
return AFPERR_DIRNEMPT;
}
- strcpy(path + DOT_APPLEDOUBLE_LEN, de->d_name);
+ strcat(path, de->d_name);
if ((err = netatalk_unlink(path))) {
closedir(dp);
return err;

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-etc_afpd_file_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/afpd/file.c.orig Thu Apr 28 05:24:04 2005
+++ etc/afpd/file.c Fri Dec 30 23:30:05 2005
@@ -1026,7 +1026,7 @@ const struct vol *vol;
char *src, *dst, *newname;
struct adouble *adp;
{
- char adsrc[ MAXPATHLEN + 1];
+ char adsrc[ MAXPATHLEN];
int rc;
#ifdef DEBUG
@@ -1061,7 +1061,7 @@ struct adouble *adp;
}
}
- strcpy( adsrc, vol->ad_path( src, 0 ));
+ strlcpy( adsrc, vol->ad_path( src, 0 ), sizeof(adsrc));
if (unix_rename( adsrc, vol->ad_path( dst, 0 )) < 0 ) {
struct stat st;

View File

@ -0,0 +1,39 @@
$OpenBSD: patch-etc_afpd_mangle_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/afpd/mangle.c.orig Mon Feb 14 11:01:54 2005
+++ etc/afpd/mangle.c Sat Dec 31 14:19:54 2005
@@ -235,7 +235,7 @@ unsigned char *
mangle(const struct vol *vol, unsigned char *filename, size_t filenamelen, unsigned char *uname, cnid_t id, int flags) {
unsigned char *ext = NULL;
unsigned char *m = NULL;
- static unsigned char mfilename[MAXPATHLEN + 1];
+ static unsigned char mfilename[MAXPATHLEN];
unsigned char mangle_suffix[MANGLE_LENGTH + 1];
size_t ext_len = 0;
size_t maxlen;
@@ -259,19 +259,19 @@ mangle(const struct vol *vol, unsigned c
ext_len = MAX_EXT_LENGTH;
}
}
- m = mfilename;
- k = sprintf(mangle_suffix, "%c%X", MANGLE_CHAR, ntohl(id));
+ k = snprintf(mangle_suffix, sizeof(mangle_suffix), "%c%X", MANGLE_CHAR, ntohl(id));
- strlcpy(m, filename, maxlen - k - ext_len +1);
+ strlcpy(mfilename, filename, maxlen - k - ext_len +1);
+ m = mfilename;
if (flags & 2)
m = utf8_mangle_validate(m, maxlen - k - ext_len +1);
if (*m == 0) {
- strcat(m, "???");
+ strlcat(mfilename, "???", sizeof(mfilename));
}
- strcat(m, mangle_suffix);
+ strlcat(mfilename, mangle_suffix, sizeof(mfilename));
if (ext) {
- strncat(m, ext, ext_len);
+ strlcat(mfilename, ext, sizeof(mfilename));
}
- return m;
+ return mfilename;
}

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-etc_afpd_ofork_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/afpd/ofork.c.orig Wed Feb 9 20:23:15 2005
+++ etc/afpd/ofork.c Sat Dec 31 00:29:55 2005
@@ -289,7 +289,7 @@ int ret;
/* -------------------------- */
int of_statdir (const struct vol *vol, struct path *path)
{
-static char pathname[ MAXPATHLEN + 1];
+static char pathname[ MAXPATHLEN];
int ret;
if (*path->m_name) {
@@ -299,8 +299,8 @@ int ret;
path->st_errno = 0;
path->st_valid = 1;
/* FIXME, what about: we don't have r-x perm anymore ? */
- strcpy(pathname, "../");
- strlcat(pathname, path->d_dir->d_u_name, MAXPATHLEN);
+ strlcpy(pathname, "../", sizeof(pathname));
+ strlcat(pathname, path->d_dir->d_u_name, sizeof(pathname));
if (!(ret = stat(pathname, &path->st)))
return 0;

View File

@ -0,0 +1,140 @@
$OpenBSD: patch-etc_afpd_unix_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/afpd/unix.c.orig Tue Jun 15 18:53:55 2004
+++ etc/afpd/unix.c Fri Dec 30 23:04:27 2005
@@ -342,8 +342,8 @@ const mode_t mode;
strcmp( deskp->d_name, ".." ) == 0 || strlen( deskp->d_name ) > 2 ) {
continue;
}
- strcpy( modbuf, deskp->d_name );
- strcat( modbuf, "/" );
+ strlcpy( modbuf, deskp->d_name, sizeof(modbuf) );
+ strlcat( modbuf, "/", sizeof(modbuf) );
m = strchr( modbuf, '\0' );
if (( sub = opendir( deskp->d_name )) == NULL ) {
continue;
@@ -354,7 +354,7 @@ const mode_t mode;
continue;
}
*m = '\0';
- strcat( modbuf, subp->d_name );
+ strlcat( modbuf, subp->d_name, sizeof(modbuf) );
/* XXX: need to preserve special modes */
if (stat(modbuf, &st) < 0) {
LOG(log_error, logtype_afpd, "setdeskmode: stat %s: %s",fullpathname(modbuf), strerror(errno) );
@@ -471,7 +471,7 @@ const struct vol *vol;
const char *name;
const mode_t mode;
{
- char buf[ MAXPATHLEN + 1];
+ char buf[ MAXPATHLEN];
struct stat st;
char *m;
struct dirent *dirp;
@@ -540,8 +540,8 @@ const mode_t mode;
LOG(log_error, logtype_afpd, "setdirmode: opendir %s: %s", fullpathname(".AppleDouble"),strerror(errno) );
return( -1 );
}
- strcpy( buf, adouble_p);
- strcat( buf, "/" );
+ strlcpy( buf, adouble_p, sizeof(buf));
+ strlcat( buf, "/", sizeof(buf) );
m = strchr( buf, '\0' );
for ( dirp = readdir( dir ); dirp != NULL; dirp = readdir( dir )) {
if ( strcmp( dirp->d_name, "." ) == 0 ||
@@ -549,7 +549,7 @@ const mode_t mode;
continue;
}
*m = '\0';
- strcat( buf, dirp->d_name );
+ strlcat( buf, dirp->d_name, sizeof(buf) );
if ( stat( buf, &st ) < 0 ) {
LOG(log_error, logtype_afpd, "setdirmode: stat %s: %s", buf, strerror(errno) );
@@ -582,7 +582,7 @@ int setdeskowner( uid, gid )
const uid_t uid;
const gid_t gid;
{
- char wd[ MAXPATHLEN + 1];
+ char wd[ MAXPATHLEN];
char modbuf[12 + 1], *m;
struct dirent *deskp, *subp;
DIR *desk, *sub;
@@ -605,8 +605,8 @@ const gid_t gid;
strlen( deskp->d_name ) > 2 ) {
continue;
}
- strcpy( modbuf, deskp->d_name );
- strcat( modbuf, "/" );
+ strlcpy( modbuf, deskp->d_name, sizeof(modbuf));
+ strlcat( modbuf, "/", sizeof(modbuf) );
m = strchr( modbuf, '\0' );
if (( sub = opendir( deskp->d_name )) == NULL ) {
continue;
@@ -617,7 +617,7 @@ const gid_t gid;
continue;
}
*m = '\0';
- strcat( modbuf, subp->d_name );
+ strlcat( modbuf, subp->d_name, sizeof(modbuf) );
/* XXX: add special any uid, ignore group bits */
if ( chown( modbuf, uid, gid ) < 0 && errno != EPERM ) {
LOG(log_error, logtype_afpd, "setdeskown: chown %s: %s", fullpathname(modbuf), strerror(errno) );
@@ -692,7 +692,7 @@ const char *name;
const uid_t uid;
const gid_t gid;
{
- char buf[ MAXPATHLEN + 1];
+ char buf[ MAXPATHLEN];
struct stat st;
char *m;
struct dirent *dirp;
@@ -735,16 +735,16 @@ const gid_t gid;
goto setdirowner_noadouble;
return( -1 );
}
- strcpy( buf, adouble_p );
- strcat( buf, "/" );
- m = strchr( buf, '\0' );
+ strlcpy( buf, adouble_p, sizeof(buf) );
+ strlcat( buf, "/", sizeof(buf) );
+ m = strchr(buf, '\0');
for ( dirp = readdir( dir ); dirp != NULL; dirp = readdir( dir )) {
if ( strcmp( dirp->d_name, "." ) == 0 ||
strcmp( dirp->d_name, ".." ) == 0 ) {
continue;
}
*m = '\0';
- strcat( buf, dirp->d_name );
+ strlcat( buf, dirp->d_name, sizeof(buf));
if ( chown( buf, uid, gid ) < 0 && errno != EPERM ) {
LOG(log_debug, logtype_afpd, "setdirowner: chown %d/%d %s: %s",
uid, gid, fullpathname(buf), strerror(errno) );
@@ -788,8 +788,8 @@ static int recursive_chown(const char *p
struct dirent *entry;
char *name;
int ret = 0;
- char newpath[PATH_MAX+1];
- newpath[PATH_MAX] = '\0';
+ char newpath[PATH_MAX];
+ newpath[PATH_MAX - 1] = '\0';
if (chown(path, uid, gid) < 0) {
LOG(log_error, logtype_afpd, "cannot chown() file [%s] (uid = %d): %s", path, uid, strerror(errno));
@@ -831,7 +831,7 @@ recursive_chown_end:
int unix_rename(const char *oldpath, const char *newpath)
{
#if 0
- char pd_name[PATH_MAX+1];
+ char pd_name[PATH_MAX];
int i;
struct stat pd_stat;
uid_t uid;
@@ -840,7 +840,7 @@ int unix_rename(const char *oldpath, con
if (rename(oldpath, newpath) < 0)
return -1;
#if 0
- for (i = 0; i <= PATH_MAX && newpath[i] != '\0'; i++)
+ for (i = 0; i < PATH_MAX && newpath[i] != '\0'; i++)
pd_name[i] = newpath[i];
pd_name[i] = '\0';

View File

@ -0,0 +1,208 @@
$OpenBSD: patch-etc_afpd_volume_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/afpd/volume.c.orig Sun Apr 24 18:26:31 2005
+++ etc/afpd/volume.c Sat Dec 31 12:09:29 2005
@@ -231,13 +231,14 @@ static char *volxlate(AFPObj *obj, char
return NULL;
}
if (!dest) {
- dest = calloc(destlen +1, 1);
+ destlen++;
+ dest = malloc(destlen);
}
ret = dest;
if (!ret) {
return NULL;
}
- strlcpy(dest, src, destlen +1);
+ strlcpy(dest, src, destlen);
if ((p = strchr(src, '$')) == NULL) /* nothing to do */
return ret;
@@ -262,7 +263,7 @@ static char *volxlate(AFPObj *obj, char
if (obj->proto == AFPPROTO_ASP) {
ASP asp = obj->handle;
- len = sprintf(dest, "%u.%u", ntohs(asp->asp_sat.sat_addr.s_net),
+ len = snprintf(dest, destlen, "%u.%u", ntohs(asp->asp_sat.sat_addr.s_net),
asp->asp_sat.sat_addr.s_node);
dest += len;
destlen -= len;
@@ -270,7 +271,7 @@ static char *volxlate(AFPObj *obj, char
} else if (obj->proto == AFPPROTO_DSI) {
DSI *dsi = obj->handle;
- len = sprintf(dest, "%s:%u", inet_ntoa(dsi->client.sin_addr),
+ len = snprintf(dest, destlen, "%s:%u", inet_ntoa(dsi->client.sin_addr),
ntohs(dsi->client.sin_port));
dest += len;
destlen -= len;
@@ -291,7 +292,7 @@ static char *volxlate(AFPObj *obj, char
if (obj->proto == AFPPROTO_ASP) {
ASP asp = obj->handle;
- len = sprintf(dest, "%u", ntohs(asp->asp_sat.sat_addr.s_net));
+ len = snprintf(dest, destlen, "%u", ntohs(asp->asp_sat.sat_addr.s_net));
dest += len;
destlen -= len;
@@ -606,14 +607,13 @@ static int creatvol(AFPObj *obj, struct
free(volume);
return -1;
}
- if (!( volume->v_path = (char *)malloc( strlen( path ) + 1 )) ) {
+ if ((volume->v_path = strdup( path )) == NULL) {
LOG(log_error, logtype_afpd, "creatvol: malloc: %s", strerror(errno) );
free(volume->v_name);
free(volume);
return -1;
}
volume->v_hide = hide;
- strcpy( volume->v_path, path );
#ifdef __svr4__
volume->v_qfd = -1;
@@ -910,8 +910,8 @@ int user;
struct passwd *pwent;
{
FILE *fp;
- char path[ MAXPATHLEN + 1], tmp[ MAXPATHLEN + 1],
- volname[ AFPVOL_NAMELEN + 1 ], buf[ BUFSIZ ],
+ char path[ MAXPATHLEN ], tmp[ MAXPATHLEN ],
+ volname[ AFPVOL_NAMELEN ], buf[ BUFSIZ ],
type[ 5 ], creator[ 5 ];
char *u, *p;
struct passwd *pw;
@@ -923,10 +923,10 @@ struct passwd *pwent;
if (!p1->name)
return -1;
p1->mtime = 0;
- strcpy( path, p1->name );
+ strlcpy( path, p1->name , sizeof(path));
if ( p2 != NULL ) {
- strcat( path, "/" );
- strcat( path, p2 );
+ strlcat( path, "/", sizeof(path) );
+ strlcat( path, p2, sizeof(path) );
if (p1->full_name) {
free(p1->full_name);
}
@@ -942,9 +942,9 @@ struct passwd *pwent;
}
memset(save_options, 0, sizeof(save_options));
- while ( myfgets( buf, sizeof( buf ), fp ) != NULL ) {
+ while ( myfgets( buf, sizeof( buf ) - 1, fp ) != NULL ) {
initline( strlen( buf ), buf );
- parseline( sizeof( path ) - 1, path );
+ parseline( sizeof( path ) , path );
switch ( *path ) {
case '\0' :
case '#' :
@@ -955,10 +955,10 @@ struct passwd *pwent;
if (strncmp(path, VOLOPT_DEFAULT, VOLOPT_DEFAULT_LEN) == 0) {
*tmp = '\0';
for (i = 0; i < VOLOPT_NUM; i++) {
- if (parseline( sizeof( path ) - VOLOPT_DEFAULT_LEN - 1,
+ if (parseline( sizeof( path ) - VOLOPT_DEFAULT_LEN,
path + VOLOPT_DEFAULT_LEN) < 0)
break;
- volset(save_options, NULL, tmp, sizeof(tmp) - 1,
+ volset(save_options, NULL, tmp, sizeof(tmp),
path + VOLOPT_DEFAULT_LEN);
}
}
@@ -976,10 +976,10 @@ struct passwd *pwent;
if ( u == NULL || *u == '\0' || ( pw = getpwnam( u )) == NULL ) {
continue;
}
- strcpy( tmp, pw->pw_dir );
+ strlcpy( tmp, pw->pw_dir, sizeof(tmp) );
if ( p != NULL && *p != '\0' ) {
- strcat( tmp, "/" );
- strcat( tmp, p );
+ strlcat( tmp, "/", sizeof(tmp) );
+ strlcat( tmp, p, sizeof(tmp) );
}
/* Tag a user's home directory with their umask. Note, this will
* be overwritten if the user actually specifies a umask: option
@@ -990,7 +990,7 @@ struct passwd *pwent;
case '/' :
/* send path through variable substitution */
if (*path != '~') /* need to copy path to tmp */
- strcpy(tmp, path);
+ strlcpy(tmp, path, sizeof(tmp));
if (!pwent)
pwent = getpwnam(obj->username);
volxlate(obj, path, sizeof(path) - 1, tmp, pwent, NULL, NULL);
@@ -1019,10 +1019,10 @@ struct passwd *pwent;
/* read in up to VOLOP_NUM possible options */
for (i = 0; i < VOLOPT_NUM; i++) {
- if (parseline( sizeof( tmp ) - 1, tmp ) < 0)
+ if (parseline( sizeof( tmp ), tmp ) < 0)
break;
- volset(options, save_options, volname, sizeof(volname) - 1, tmp);
+ volset(options, save_options, volname, sizeof(volname), tmp);
}
/* check allow/deny lists:
@@ -2103,9 +2103,9 @@ static int create_special_folder (const
u_int16_t attr;
struct stat st;
int ret;
+ size_t plen = strlen(vol->v_path) + strlen(folder->name) + 2;
-
- p = (char *) malloc ( strlen(vol->v_path)+strlen(folder->name)+2);
+ p = (char *) malloc(plen);
if ( p == NULL) {
LOG(log_error, logtype_afpd,"malloc failed");
exit (EXITERR_SYS);
@@ -2117,8 +2117,8 @@ static int create_special_folder (const
exit (EXITERR_SYS);
}
- strcpy(p, vol->v_path);
- strcat(p, "/");
+ strlcpy(p, vol->v_path, plen);
+ strlcat(p, "/", plen);
r=q;
while (*r) {
@@ -2128,7 +2128,7 @@ static int create_special_folder (const
*r=tolower(*r);
r++;
}
- strcat(p, q);
+ strlcat(p, q, plen);
if ( (ret = stat( p, &st )) < 0 ) {
if (folder->precreate) {
@@ -2259,7 +2259,7 @@ static int savevoloptions (const struct
snprintf(item, sizeof(item), "CNIDDBDPORT:%u\n", Cnid_port);
strlcat(buf, item, sizeof(buf));
- strcpy(item, "CNID_DBPATH:");
+ strlcpy(item, "CNID_DBPATH:", sizeof(item));
if (vol->v_dbpath)
strlcat(item, vol->v_dbpath, sizeof(item));
else
@@ -2268,7 +2268,7 @@ static int savevoloptions (const struct
strlcat(buf, item, sizeof(buf));
/* volume flags */
- strcpy(item, "VOLUME_OPTS:");
+ strlcpy(item, "VOLUME_OPTS:", sizeof(item));
for (;op->name; op++) {
if ( (vol->v_flags & op->option) ) {
strlcat(item, op->name, sizeof(item));
@@ -2279,7 +2279,7 @@ static int savevoloptions (const struct
strlcat(buf, item, sizeof(buf));
/* casefold flags */
- strcpy(item, "VOLCASEFOLD:");
+ strlcpy(item, "VOLCASEFOLD:", sizeof(item));
for (;cf->name; cf++) {
if ( (vol->v_casefold & cf->option) ) {
strlcat(item, cf->name, sizeof(item));

View File

@ -0,0 +1,53 @@
$OpenBSD: patch-etc_atalkd_config_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/atalkd/config.c.orig Sun Feb 6 05:16:02 2005
+++ etc/atalkd/config.c Sat Dec 31 01:17:42 2005
@@ -101,12 +101,11 @@ char **parseline(const char *line)
return NULL;
}
- buffer = (char *) malloc( strlen( p ) + 1 );
- if ( !buffer ) {
- /* FIXME: error handling */
- return NULL;
- }
- strcpy( buffer, p );
+ buffer = strdup(p);
+ if (buffer == NULL) {
+ /* FIXME: error handling */
+ return NULL;
+ }
tmpbuf = buffer;
argv = (char **) malloc( ARGV_CHUNK_SIZE * sizeof( char * ) );
@@ -207,9 +206,9 @@ int writeconf( cf )
}
if (( p = strrchr( path, '/' )) == NULL ) {
- strcpy( newpath, _PATH_ATALKDTMP );
+ strlcpy( newpath, _PATH_ATALKDTMP, sizeof(newpath) );
} else {
- sprintf( newpath, "%.*s/%s", (int)(p - path), path, _PATH_ATALKDTMP );
+ snprintf( newpath, sizeof(newpath), "%.*s/%s", (int)(p - path), path, _PATH_ATALKDTMP );
}
if (( fd = open( newpath, O_WRONLY|O_CREAT|O_TRUNC, mode )) < 0 ) {
LOG(log_error, logtype_atalkd, "%s: %s", newpath, strerror(errno) );
@@ -832,7 +831,7 @@ struct interface *newiface( name )
int plumb()
{
struct interface *iface;
- char device[ MAXPATHLEN + 1], *p;
+ char device[ MAXPATHLEN ], *p;
int fd, ppa;
for ( iface = interfaces; iface != NULL; iface = iface->i_next ) {
@@ -840,8 +839,8 @@ int plumb()
continue;
}
- strcpy( device, "/dev/" );
- strcat( device, iface->i_name );
+ strlcpy( device, "/dev/", sizeof(device) );
+ strlcat( device, iface->i_name, sizeof(device) );
if (( p = strpbrk( device, "0123456789" )) == NULL ) {
LOG(log_error, logtype_atalkd, "plumb: invalid device: %s", device );
return -1;

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-etc_atalkd_main_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/atalkd/main.c.orig Mon Jan 31 12:01:04 2005
+++ etc/atalkd/main.c Sat Dec 31 12:43:51 2005
@@ -1456,7 +1456,7 @@ int ifconfig( iname, cmd, sa )
int s;
memset(&ifr, 0, sizeof(ifr));
- strcpy( ifr.ifr_name, iname );
+ strlcpy( ifr.ifr_name, iname, ifr.ifr_name );
ifr.ifr_addr = *(struct sockaddr *)sa;
if (( s = socket( AF_APPLETALK, SOCK_DGRAM, 0 )) < 0 ) {

View File

@ -0,0 +1,56 @@
$OpenBSD: patch-etc_cnid_dbd_cnid_metad_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/cnid_dbd/cnid_metad.c.orig Mon Sep 6 03:19:21 2004
+++ etc/cnid_dbd/cnid_metad.c Sat Dec 31 12:40:35 2005
@@ -270,8 +270,8 @@ static int maybe_start_dbd(char *dbdpn,
}
}
- sprintf(buf1, "%i", sv[1]);
- sprintf(buf2, "%i", rqstfd);
+ snprintf(buf1, sizeof(buf1), "%i", sv[1]);
+ snprintf(buf2, sizeof(buf2), "%i", rqstfd);
if (up->count == MAXSPAWN) {
/* there's a pb with the db inform child
@@ -298,7 +298,7 @@ static int maybe_start_dbd(char *dbdpn,
}
/* ------------------ */
-static int set_dbdir(char *dbdir, int len)
+static int set_dbdir(char *dbdir, size_t len)
{
struct stat st;
@@ -310,11 +310,11 @@ static int set_dbdir(char *dbdir, int le
return -1;
}
- if (dbdir[len - 1] != '/') {
- strcat(dbdir, "/");
+ if (dbdir[strlen(dbdir) - 1] != '/') {
+ strlcat(dbdir, "/", len);
len++;
}
- strcpy(dbdir + len, DBHOME);
+ strlcat(dbdir, DBHOME, len);
if (stat(dbdir, &st) < 0 && mkdir(dbdir, 0755 ) < 0) {
LOG(log_error, logtype_cnid, "set_dbdir: mkdir failed for %s", dbdir);
return -1;
@@ -365,7 +365,7 @@ char *group;
/* ------------------ */
int main(int argc, char *argv[])
{
- char dbdir[MAXPATHLEN + 1];
+ char dbdir[MAXPATHLEN];
int len;
pid_t pid;
int status;
@@ -529,7 +529,7 @@ int main(int argc, char *argv[])
}
dbdir[len] = '\0';
- if (set_dbdir(dbdir, len) < 0) {
+ if (set_dbdir(dbdir, sizeof(dbdir)) < 0) {
goto loop_end;
}

View File

@ -0,0 +1,43 @@
$OpenBSD: patch-etc_cnid_dbd_db_param_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/cnid_dbd/db_param.c.orig Tue Dec 21 08:36:12 2004
+++ etc/cnid_dbd/db_param.c Sat Dec 31 12:34:18 2005
@@ -43,29 +43,27 @@
static struct db_param params;
static int parse_err;
-static int usock_maxlen()
+static size_t usock_maxlen()
{
struct sockaddr_un addr;
- return sizeof(addr.sun_path) - 1;
+ return sizeof(addr.sun_path);
}
-static int make_pathname(char *path, char *dir, char *fn, int maxlen)
+static int make_pathname(char *path, char *dir, char *fn, size_t maxlen)
{
size_t len;
if (fn[0] != '/') {
- len = strlen(dir);
- if (len + 1 + strlen(fn) > maxlen)
- return -1;
- strcpy(path, dir);
+ if ((len = strlcpy(path, dir, maxlen)) >= maxlen)
+ return -1;
if (path[len - 1] != '/')
- strcat(path, "/");
- strcat(path, fn);
+ strlcat(path, "/", maxlen);
+ if (strlcat(path, fn, maxlen) >= maxlen)
+ return -1;
} else {
- if (strlen(fn) > maxlen)
- return -1;
- strcpy(path, fn);
+ if (strlcpy(path, fn, maxlen) >= maxlen)
+ return -1;
}
return 0;
}

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-etc_cnid_dbd_dbd_dbcheck_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/cnid_dbd/dbd_dbcheck.c.orig Tue Jan 25 09:34:27 2005
+++ etc/cnid_dbd/dbd_dbcheck.c Fri Dec 30 23:50:57 2005
@@ -14,6 +14,7 @@
#include <string.h>
#include <sys/param.h>
#include <errno.h>
+#include <sys/types.h>
#include <netatalk/endian.h>
#include <atalk/logger.h>
#include <atalk/cnid_dbd_private.h>

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-etc_cnid_dbd_dbd_delete_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/cnid_dbd/dbd_delete.c.orig Wed Jan 21 16:28:42 2004
+++ etc/cnid_dbd/dbd_delete.c Fri Dec 30 23:47:29 2005
@@ -11,6 +11,7 @@
#include <string.h>
#include <errno.h>
+#include <sys/types.h>
#include <netatalk/endian.h>
#include <atalk/logger.h>
#include <atalk/cnid_dbd_private.h>

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-etc_cnid_dbd_dbd_get_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/cnid_dbd/dbd_get.c.orig Wed Jan 21 16:28:42 2004
+++ etc/cnid_dbd/dbd_get.c Fri Dec 30 23:51:53 2005
@@ -13,6 +13,7 @@
#include <sys/param.h>
#include <atalk/logger.h>
#include <errno.h>
+#include <sys/types.h>
#include <netatalk/endian.h>
#include <atalk/cnid_dbd_private.h>

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-etc_cnid_dbd_dbd_getstamp_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/cnid_dbd/dbd_getstamp.c.orig Sat Feb 7 14:46:08 2004
+++ etc/cnid_dbd/dbd_getstamp.c Fri Dec 30 23:49:23 2005
@@ -12,6 +12,7 @@
#include <string.h>
#include <atalk/logger.h>
#include <errno.h>
+#include <sys/types.h>
#include <netatalk/endian.h>
#include <atalk/cnid_dbd_private.h>

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-etc_cnid_dbd_dbd_lookup_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/cnid_dbd/dbd_lookup.c.orig Sat Feb 7 14:46:08 2004
+++ etc/cnid_dbd/dbd_lookup.c Fri Dec 30 23:53:00 2005
@@ -14,6 +14,7 @@
#include <string.h>
#include <sys/param.h>
#include <errno.h>
+#include <sys/types.h>
#include <netatalk/endian.h>
#include <atalk/logger.h>
#include <atalk/cnid_dbd_private.h>

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-etc_cnid_dbd_dbd_resolve_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/cnid_dbd/dbd_resolve.c.orig Sat Feb 7 14:46:08 2004
+++ etc/cnid_dbd/dbd_resolve.c Fri Dec 30 23:41:56 2005
@@ -12,6 +12,7 @@
#include <string.h>
#include <atalk/logger.h>
#include <errno.h>
+#include <sys/types.h>
#include <netatalk/endian.h>
#include <atalk/cnid_dbd_private.h>

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-etc_cnid_dbd_dbd_update_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/cnid_dbd/dbd_update.c.orig Fri Dec 30 23:46:17 2005
+++ etc/cnid_dbd/dbd_update.c Fri Dec 30 23:44:48 2005
@@ -12,6 +12,7 @@
#include <string.h>
#include <errno.h>
#include <atalk/logger.h>
+#include <sys/types.h>
#include <netatalk/endian.h>
#include <atalk/cnid_dbd_private.h>

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-etc_cnid_dbd_pack_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/cnid_dbd/pack.c.orig Sat Feb 7 14:46:08 2004
+++ etc/cnid_dbd/pack.c Fri Dec 30 21:11:40 2005
@@ -9,8 +9,6 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
-#include <netatalk/endian.h>
-
#include <string.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -18,6 +16,8 @@
#include <sys/param.h>
#include <sys/cdefs.h>
#include <db.h>
+
+#include <netatalk/endian.h>
#include <atalk/cnid_dbd_private.h>
#include "pack.h"

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-etc_papd_auth_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/papd/auth.c.orig Fri Mar 11 10:36:59 2005
+++ etc/papd/auth.c Sat Dec 31 13:10:37 2005
@@ -96,7 +96,7 @@ int auth_register(const int type, struct
/* load all of the modules */
int auth_load(const char *path, const char *list)
{
- char name[MAXPATHLEN + 1], buf[MAXPATHLEN + 1], *p;
+ char name[MAXPATHLEN], buf[MAXPATHLEN], *p;
struct uam_mod *mod;
struct stat st;
int len;
@@ -108,9 +108,9 @@ int auth_load(const char *path, const ch
if ((p = strtok(buf, ",")) == NULL)
return -1;
- strcpy(name, path);
+ strlcpy(name, path, sizeof(name));
if (name[len - 1] != '/') {
- strcat(name, "/");
+ strlcat(name, "/", sizeof(name));
len++;
}

View File

@ -0,0 +1,84 @@
$OpenBSD: patch-etc_papd_lp_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/papd/lp.c.orig Tue Jun 8 22:24:47 2004
+++ etc/papd/lp.c Sat Dec 31 01:31:29 2005
@@ -377,7 +377,7 @@ int lp_init( out, sat )
FILE *cap_file;
memset( auth_string, 0, 256 );
- sprintf(addr_filename, "%s/net%d.%dnode%d",
+ snprintf(addr_filename, sizeof(addr_filename), "%s/net%d.%dnode%d",
printer->p_authprintdir, addr_net/256, addr_net%256,
addr_node);
if (stat(addr_filename, &cap_st) == 0) {
@@ -489,7 +489,7 @@ int lp_init( out, sat )
lp.lp_seq = n;
n = ( n + 1 ) % 1000;
- sprintf( buf, "%03d\n", n );
+ snprintf( buf, sizeof(buf), "%03d\n", n );
lseek( fd, 0L, 0 );
write( fd, buf, strlen( buf ));
close( fd );
@@ -558,7 +558,7 @@ int lp_open( out, sat )
}
LOG(log_debug, logtype_papd, "lp_open: opened %s", pipexlate(printer->p_printer) );
} else {
- sprintf( name, "df%c%03d%s", lp.lp_letter++, lp.lp_seq, hostname );
+ snprintf( name, sizeof(name), "df%c%03d%s", lp.lp_letter++, lp.lp_seq, hostname );
if (( fd = open( name, O_WRONLY|O_CREAT|O_EXCL, 0660 )) < 0 ) {
LOG(log_error, logtype_papd, "lp_open %s: %m", name );
@@ -719,7 +719,7 @@ int lp_cancel()
}
for ( letter = 'A'; letter < lp.lp_letter; letter++ ) {
- sprintf( name, "df%c%03d%s", letter, lp.lp_seq, hostname );
+ snprintf( name, sizeof(name), "df%c%03d%s", letter, lp.lp_seq, hostname );
if ( unlink( name ) < 0 ) {
LOG(log_error, logtype_papd, "lp_cancel unlink %s: %m", name );
}
@@ -753,7 +753,7 @@ int lp_print()
if ( printer->p_flags & P_SPOOLED ) {
#ifndef HAVE_CUPS
- sprintf( tfname, "tfA%03d%s", lp.lp_seq, hostname );
+ snprintf( tfname, sizeof(tfname), "tfA%03d%s", lp.lp_seq, hostname );
if (( fd = open( tfname, O_WRONLY|O_EXCL|O_CREAT, 0660 )) < 0 ) {
LOG(log_error, logtype_papd, "lp_print %s: %m", tfname );
return 0;
@@ -798,7 +798,7 @@ int lp_print()
}
fclose( cfile );
- sprintf( cfname, "cfA%03d%s", lp.lp_seq, hostname );
+ snprintf( cfname, sizeof(cfname), "cfA%03d%s", lp.lp_seq, hostname );
if ( link( tfname, cfname ) < 0 ) {
LOG(log_error, logtype_papd, "lp_print can't link %s to %s: %m", cfname,
tfname );
@@ -811,7 +811,7 @@ int lp_print()
return 0;
}
- sprintf( buf, "\1%s\n", printer->p_printer );
+ snprintf( buf, sizeof(buf), "\1%s\n", printer->p_printer );
n = strlen( buf );
if ( write( s, buf, n ) != n ) {
LOG(log_error, logtype_papd, "lp_print write: %m" );
@@ -944,7 +944,7 @@ int lp_rmjob( job )
return( -1 );
}
- sprintf( buf, "\5%s %s %d\n", printer->p_printer, lp.lp_person, job );
+ snprintf( buf, sizeof(buf), "\5%s %s %d\n", printer->p_printer, lp.lp_person, job );
n = strlen( buf );
if ( write( s, buf, n ) != n ) {
LOG(log_error, logtype_papd, "lp_rmjob write: %m" );
@@ -982,7 +982,7 @@ int lp_queue( out )
return( -1 );
}
- sprintf( buf, "\3%s\n", printer->p_printer );
+ snprintf( buf, sizeof(buf), "\3%s\n", printer->p_printer );
n = strlen( buf );
if ( write( s, buf, n ) != n ) {
LOG(log_error, logtype_papd, "lp_queue write: %m" );

View File

@ -0,0 +1,195 @@
$OpenBSD: patch-etc_papd_main_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/papd/main.c.orig Tue Jun 8 21:25:53 2004
+++ etc/papd/main.c Sat Dec 31 02:51:53 2005
@@ -196,12 +196,10 @@ int main( ac, av )
if (( p = strchr( hostname, '.' )) != 0 ) {
*p = '\0';
}
- if (( defprinter.p_name = (char *)malloc( strlen( hostname ) + 1 ))
- == NULL ) {
+ if (( defprinter.p_name = strdup(hostname)) == NULL ) {
perror( "malloc" );
exit( 1 );
}
- strcpy( defprinter.p_name, hostname );
defprinter.p_type = "LaserWriter";
defprinter.p_zone = "*";
memset(&defprinter.p_addr, 0, sizeof(defprinter.p_addr));
@@ -583,8 +581,8 @@ int getstatus( pr, buf )
int fd = -1, rc;
if ( pr->p_flags & P_SPOOLED && ( pr->p_spool != NULL )) {
- strcpy( path, pr->p_spool );
- strcat( path, "/status" );
+ strlcpy( path, pr->p_spool, sizeof(path));
+ strlcat( path, "/status", sizeof(path));
fd = open( path, O_RDONLY);
}
@@ -643,29 +641,26 @@ static void getprinters( cf )
exit( 1 );
}
if ( name != defprinter.p_name ) {
- if (( pr->p_name = (char *)malloc( strlen( name ) + 1 )) == NULL ) {
+ if (( pr->p_name = strdup(name)) == NULL ) {
perror( "malloc" );
exit( 1 );
}
- strcpy( pr->p_name, name );
} else {
pr->p_name = name;
}
if ( type != defprinter.p_type ) {
- if (( pr->p_type = (char *)malloc( strlen( type ) + 1 )) == NULL ) {
+ if (( pr->p_type = strdup( type )) == NULL ) {
perror( "malloc" );
exit( 1 );
}
- strcpy( pr->p_type, type );
} else {
pr->p_type = type;
}
if ( zone != defprinter.p_zone ) {
- if (( pr->p_zone = (char *)malloc( strlen( zone ) + 1 )) == NULL ) {
+ if (( pr->p_zone = strdup( zone )) == NULL ) {
perror( "malloc" );
exit( 1 );
}
- strcpy( pr->p_zone, zone );
} else {
pr->p_zone = zone;
}
@@ -681,11 +676,10 @@ static void getprinters( cf )
if (( p = pgetstr( "pd", &a )) == NULL ) {
pr->p_ppdfile = defprinter.p_ppdfile;
} else {
- if (( pr->p_ppdfile = (char *)malloc( strlen( p ) + 1 )) == NULL ) {
+ if (( pr->p_ppdfile = strdup( p )) == NULL ) {
perror( "malloc" );
exit( 1 );
}
- strcpy( pr->p_ppdfile, p );
}
/*
@@ -701,22 +695,20 @@ static void getprinters( cf )
} else {
pr->p_flags = P_SPOOLED;
}
- if (( pr->p_printer = (char *)malloc( strlen( p ) + 1 )) == NULL ) {
+ if (( pr->p_printer = strdup( p )) == NULL ) {
perror( "malloc" );
exit( 1 );
}
- strcpy( pr->p_printer, p );
}
/*
* Do we want authenticated printing?
*/
if ((p = pgetstr( "ca", &a )) != NULL ) {
- if ((pr->p_authprintdir = (char *)malloc(strlen(p)+1)) == NULL) {
+ if ((pr->p_authprintdir = strdup(p)) == NULL) {
perror( "malloc" );
exit(1);
}
- strcpy( pr->p_authprintdir, p );
pr->p_flags |= P_AUTH;
pr->p_flags |= P_AUTH_CAP;
} else { pr->p_authprintdir = NULL; }
@@ -727,11 +719,10 @@ static void getprinters( cf )
}
if ((p = pgetstr("am", &a)) != NULL ) {
- if ((uamlist = (char *)malloc(strlen(p)+1)) == NULL ) {
+ if ((uamlist = strdup(p)) == NULL ) {
perror("malloc");
exit(1);
}
- strcpy(uamlist, p);
}
if ( pr->p_flags & P_SPOOLED ) {
@@ -741,12 +732,10 @@ static void getprinters( cf )
if (( p = pgetstr( "op", &a )) == NULL ) {
pr->p_operator = defprinter.p_operator;
} else {
- if (( pr->p_operator = (char *)malloc( strlen( p ) + 1 ))
- == NULL ) {
+ if (( pr->p_operator = strdup( p )) == NULL ) {
perror( "malloc" );
exit( 1 );
}
- strcpy( pr->p_operator, p );
}
}
@@ -821,11 +810,10 @@ int rprintcap( pr )
if ( pr->p_ppdfile == defprinter.p_ppdfile ) {
if ( (p = (char *) cups_get_printer_ppd ( pr->p_printer )) != NULL ) {
- if (( pr->p_ppdfile = (char *)malloc( strlen( p ) + 1 )) == NULL ) {
- LOG(log_error, logtype_papd, "malloc: %m" );
- exit( 1 );
+ if (( pr->p_ppdfile = strdup( p )) == NULL ) {
+ LOG(log_error, logtype_papd, "malloc: %m" );
+ exit( 1 );
}
- strcpy( pr->p_ppdfile, p );
pr->p_flags |= P_CUPS_PPD;
/*LOG(log_info, logtype_papd, "PPD File for %s set to %s", pr->p_printer, pr->p_ppdfile );*/
}
@@ -856,11 +844,10 @@ int rprintcap( pr )
if (( p = pgetstr( "sd", &a )) == NULL ) {
pr->p_spool = defprinter.p_spool;
} else {
- if (( pr->p_spool = (char *)malloc( strlen( p ) + 1 )) == NULL ) {
+ if (( pr->p_spool = strdup( p )) == NULL ) {
LOG(log_error, logtype_papd, "malloc: %m" );
exit( 1 );
}
- strcpy( pr->p_spool, p );
}
/*
@@ -879,12 +866,10 @@ int rprintcap( pr )
if (( p = pgetstr( "ro", &a )) == NULL ) {
pr->p_role = defprinter.p_role;
} else {
- if (( pr->p_role =
- (char *)malloc( strlen( p ) + 1 )) == NULL ) {
+ if (( pr->p_role = strdup( p )) == NULL ) {
LOG(log_error, logtype_papd, "malloc: %m" );
exit( 1 );
}
- strcpy( pr->p_role, p );
}
if (( c = pgetnum( "si" )) < 0 ) {
@@ -905,12 +890,10 @@ int rprintcap( pr )
}
a = area;
if (( p = pgetstr( "pc", &a )) != NULL ) {
- if (( pr->p_pagecost_msg =
- (char *)malloc( strlen( p ) + 1 )) == NULL ) {
+ if (( pr->p_pagecost_msg = strdup( p )) == NULL ) {
LOG(log_error, logtype_papd, "malloc: %m" );
exit( 1 );
}
- strcpy( pr->p_pagecost_msg, p );
pr->p_pagecost = 0;
} else if ( pr->p_flags & P_ACCOUNT ) {
if (( c = pgetnum( "pc" )) < 0 ) {
@@ -931,11 +914,10 @@ int rprintcap( pr )
if (( p = pgetstr( "lo", &a )) == NULL ) {
pr->p_lock = defprinter.p_lock;
} else {
- if (( pr->p_lock = (char *)malloc( strlen( p ) + 1 )) == NULL ) {
+ if (( pr->p_lock = strdup( p )) == NULL ) {
LOG(log_error, logtype_papd, "malloc: %m" );
exit( 1 );
}
- strcpy( pr->p_lock, p );
}
#ifdef KRB

View File

@ -0,0 +1,32 @@
$OpenBSD: patch-etc_papd_ppd_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/papd/ppd.c.orig Sun Feb 6 05:16:02 2005
+++ etc/papd/ppd.c Sat Dec 31 13:36:19 2005
@@ -219,12 +219,10 @@ int read_ppd( file, fcnt )
LOG(log_error, logtype_papd, "malloc: %m" );
exit( 1 );
}
- if (( pfo->pd_font =
- (char *)malloc( strlen( pe->pe_option ) + 1 )) == NULL ) {
+ if (( pfo->pd_font = strdup( pe->pe_option )) == NULL ) {
LOG(log_error, logtype_papd, "malloc: %m" );
exit( 1 );
}
- strcpy( pfo->pd_font, pe->pe_option );
pfo->pd_next = ppd_fonts;
ppd_fonts = pfo;
continue;
@@ -238,13 +236,10 @@ int read_ppd( file, fcnt )
}
}
if ( pfe->pd_name ) { /*&& (pfe->pd_value == NULL) ) { */
- if (( pfe->pd_value =
- (char *)malloc( strlen( pe->pe_value ) + 1 )) == NULL ) {
+ if (( pfe->pd_value = strdup( pe->pe_value )) == NULL ) {
LOG(log_error, logtype_papd, "malloc: %m" );
exit( 1 );
}
-
- strcpy( pfe->pd_value, pe->pe_value );
continue;
}
}

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-etc_papd_printcap_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/papd/printcap.c.orig Fri Jun 18 03:56:04 2004
+++ etc/papd/printcap.c Sat Dec 31 13:04:13 2005
@@ -289,7 +289,7 @@ int tnchktc( cap )
/* p now points to beginning of last field */
if (p[0] != 't' || p[1] != 'c')
return(1);
- strcpy(tcname,p+3);
+ strlcpy(tcname,p+3,sizeof(tcname));
q = tcname;
while (q && *q != ':')
q++;

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-etc_papd_queries_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- etc/papd/queries.c.orig Sun Feb 6 05:16:02 2005
+++ etc/papd/queries.c Sat Dec 31 13:06:26 2005
@@ -228,7 +228,7 @@ int gq_pagecost( out )
#ifdef ABS_PRINT
lp_pagecost();
#endif /* ABS_PRINT */
- sprintf( cost, "%d", printer->p_pagecost );
+ snprintf( cost, sizeof(cost), "%d", printer->p_pagecost );
append( out, cost, strlen( cost ));
} else {
return( -1 );
@@ -246,7 +246,7 @@ int gq_balance( out )
if ( lp_pagecost() != 0 ) {
return( -1 );
}
- sprintf( balance, "$%1.2f\n", printer->p_balance );
+ snprintf( balance, sizeof(balance), "$%1.2f\n", printer->p_balance );
append( out, balance, strlen( balance ));
return( 0 );
}

View File

@ -0,0 +1,101 @@
$OpenBSD: patch-libatalk_adouble_ad_open_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- libatalk/adouble/ad_open.c.orig Sat Feb 12 06:22:05 2005
+++ libatalk/adouble/ad_open.c Fri Dec 30 21:36:40 2005
@@ -677,31 +677,30 @@ ad_path( path, adflags )
const char *path;
int adflags;
{
- static char pathbuf[ MAXPATHLEN + 1];
- char c, *slash, buf[MAXPATHLEN + 1];
+ static char pathbuf[MAXPATHLEN];
+ char c, *slash, buf[MAXPATHLEN];
size_t l;
- l = strlcpy(buf, path, MAXPATHLEN +1);
+ l = strlcpy(buf, path, MAXPATHLEN);
if ( adflags & ADFLAGS_DIR ) {
- strcpy( pathbuf, buf);
- if ( *buf != '\0' && l < MAXPATHLEN) {
- pathbuf[l++] = '/';
- pathbuf[l] = 0;
+ strlcpy(pathbuf, buf, sizeof(pathbuf));
+ if ( *buf != '\0' ) {
+ strlcat(pathbuf, "/", sizeof(pathbuf));
}
slash = ".Parent";
} else {
if (NULL != ( slash = strrchr( buf, '/' )) ) {
c = *++slash;
*slash = '\0';
- strcpy( pathbuf, buf);
+ strlcpy(pathbuf, buf, sizeof(pathbuf));
*slash = c;
} else {
pathbuf[ 0 ] = '\0';
slash = buf;
}
}
- strlcat( pathbuf, ".AppleDouble/", MAXPATHLEN +1);
- strlcat( pathbuf, slash, MAXPATHLEN +1);
+ strlcat( pathbuf, ".AppleDouble/", MAXPATHLEN);
+ strlcat( pathbuf, slash, MAXPATHLEN);
return( pathbuf );
}
@@ -715,27 +714,27 @@ ad_path_osx( path, adflags )
const char *path;
int adflags;
{
- static char pathbuf[ MAXPATHLEN + 1];
- char c, *slash, buf[MAXPATHLEN + 1];
+ static char pathbuf[MAXPATHLEN];
+ char c, *slash, buf[MAXPATHLEN];
if (!strcmp(path,".")) {
/* fixme */
getcwd(buf, MAXPATHLEN);
}
else {
- strlcpy(buf, path, MAXPATHLEN +1);
+ strlcpy(buf, path, MAXPATHLEN);
}
if (NULL != ( slash = strrchr( buf, '/' )) ) {
c = *++slash;
*slash = '\0';
- strlcpy( pathbuf, buf, MAXPATHLEN +1);
+ strlcpy( pathbuf, buf, MAXPATHLEN);
*slash = c;
} else {
pathbuf[ 0 ] = '\0';
slash = buf;
}
- strlcat( pathbuf, "._", MAXPATHLEN +1);
- strlcat( pathbuf, slash, MAXPATHLEN +1);
+ strlcat( pathbuf, "._", MAXPATHLEN);
+ strlcat( pathbuf, slash, MAXPATHLEN);
return pathbuf;
}
@@ -751,11 +750,11 @@ char
*ad_dir(path)
const char *path;
{
- static char modebuf[ MAXPATHLEN + 1];
+ static char modebuf[ MAXPATHLEN];
char *slash;
size_t len;
- if ( (len = strlen( path )) >= MAXPATHLEN ) {
+ if ( (len = strlen( path )) >= MAXPATHLEN - 1) {
errno = ENAMETOOLONG;
return NULL; /* can't do it */
}
@@ -765,7 +764,7 @@ char
* (path or subdirectory name) to get the name we want to stat.
* For a path which is just a filename, use "." instead.
*/
- strcpy( modebuf, path );
+ strlcpy( modebuf, path, sizeof(modebuf) );
slash = strrchr( modebuf, '/' );
/* is last char a '/' */
if (slash && slash[1] == 0) {

View File

@ -0,0 +1,69 @@
$OpenBSD: patch-libatalk_cnid_cdb_cnid_cdb_open_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- libatalk/cnid/cdb/cnid_cdb_open.c.orig Sun Mar 21 23:38:51 2004
+++ libatalk/cnid/cdb/cnid_cdb_open.c Sat Dec 31 00:26:34 2005
@@ -179,21 +179,22 @@ static struct _cnid_db *cnid_cdb_new(con
/* --------------- */
static int upgrade_required(char *dbdir)
{
- char path[MAXPATHLEN + 1];
- int len, i;
+ char path[MAXPATHLEN];
+ char *p;
+ int i;
int found = 0;
struct stat st;
- strcpy(path, dbdir);
+ strlcpy(path, dbdir, sizeof(path));
- len = strlen(path);
- if (path[len - 1] != '/') {
- strcat(path, "/");
- len++;
+ p = strchr(path, '\0');
+ if (path[strlen(path) - 1] != '/') {
+ strlcat(path, "/", sizeof(path));
}
for (i = 0; old_dbfiles[i] != NULL; i++) {
- strcpy(path + len, old_dbfiles[i]);
+ *p = '\0';
+ strlcat(path, old_dbfiles[i], sizeof(path));
if ( !(stat(path, &st) < 0) ) {
found++;
continue;
@@ -210,7 +211,7 @@ static int upgrade_required(char *dbdir)
struct _cnid_db *cnid_cdb_open(const char *dir, mode_t mask)
{
struct stat st;
- char path[MAXPATHLEN + 1];
+ char path[MAXPATHLEN];
CNID_private *db;
struct _cnid_db *cdb;
int open_flag, len;
@@ -223,7 +224,7 @@ struct _cnid_db *cnid_cdb_open(const cha
/* this checks .AppleDB.
We need space for dir + '/' + DBHOMELEN + '/' + DBLEN */
- if ((len = strlen(dir)) > (MAXPATHLEN - DBHOMELEN - DBLEN - 2)) {
+ if ((len = strlen(dir)) > (MAXPATHLEN - DBHOMELEN - DBLEN - 2 - 1)) {
LOG(log_error, logtype_default, "cnid_open: Pathname too large: %s", dir);
return NULL;
}
@@ -241,13 +242,12 @@ struct _cnid_db *cnid_cdb_open(const cha
cdb->_private = (void *) db;
db->magic = CNID_DB_MAGIC;
- strcpy(path, dir);
+ strlcpy(path, dir, sizeof(path));
if (path[len - 1] != '/') {
- strcat(path, "/");
- len++;
+ strlcat(path, "/", sizeof(path));
}
- strcpy(path + len, DBHOME);
+ strlcat(path, DBHOME, sizeof(path));
if ((stat(path, &st) < 0) && (ad_mkdir(path, 0777 & ~mask) < 0)) {
LOG(log_error, logtype_default, "cnid_open: DBHOME mkdir failed for %s", path);
goto fail_adouble;

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-libatalk_cnid_cdb_cnid_cdb_private_h,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- libatalk/cnid/cdb/cnid_cdb_private.h.orig Sun Mar 21 23:38:51 2004
+++ libatalk/cnid/cdb/cnid_cdb_private.h Fri Dec 30 19:05:17 2005
@@ -9,6 +9,7 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
+#include <sys/types.h>
#include <netatalk/endian.h>
#ifdef HAVE_UNISTD_H

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-libatalk_cnid_dbd_cnid_dbd_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- libatalk/cnid/dbd/cnid_dbd.c.orig Sun Feb 6 05:16:03 2005
+++ libatalk/cnid/dbd/cnid_dbd.c Sat Dec 31 11:56:19 2005
@@ -52,7 +52,7 @@ static void RQST_RESET(struct cnid_dbd_r
}
/* ----------- */
-extern char Cnid_srv[MAXHOSTNAMELEN + 1];
+extern char Cnid_srv[MAXHOSTNAMELEN];
extern int Cnid_port;
static int tsock_getfd(char *host, int port)
@@ -398,7 +398,7 @@ struct _cnid_db *cnid_dbd_open(const cha
/* We keep a copy of the directory in the db structure so that we can
transparently reconnect later. */
- strcpy(db->db_dir, dir);
+ strlcpy(db->db_dir, dir, sizeof(db->db_dir));
db->magic = CNID_DB_MAGIC;
db->fd = -1;
#ifdef DEBUG

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-libatalk_nbp_nbp_util_c,v 1.1 2006/09/22 05:56:25 pvalchev Exp $
--- libatalk/nbp/nbp_util.c.orig Thu Jan 17 01:12:02 2002
+++ libatalk/nbp/nbp_util.c Fri Dec 30 21:49:37 2005
@@ -148,7 +148,7 @@ int nbp_name( name, objp, typep, zonep )
if ( strlen( name ) + 1 > sizeof( buf )) {
return( -1 );
}
- strcpy( buf, name );
+ strlcpy( buf, name, sizeof(buf) );
if (( p = strrchr( buf, '@' )) != NULL ) {
*p++ = '\0';

11
net/netatalk/pkg/DESCR Normal file
View File

@ -0,0 +1,11 @@
Netatalk is an open-source software package to deal with the AppleTalk
procotol suite and its relative. It can do file- and print- sharing for
macintosh and contains an equivalent of "routed" for the DDP protocol.
It also comes with a load of small utilities to ease dealing with
Macintosh file from the unix side.
New in 2.0:
- AFP 3.1
- large files (>2G) support
- long file names (up to 255 bytes)

View File

@ -2,5 +2,5 @@ To start netatalk automatically at boot time, add these lines to
/etc/rc.local:
if [ -f ${SYSCONFDIR}/netatalk/rc.atalk ]; then
. ${SYSCONFDIR}/netatalk/rc.atalk
. ${SYSCONFDIR}/netatalk/rc.atalk
fi

View File

@ -1,7 +1,6 @@
@comment $OpenBSD: PLIST,v 1.5 2004/09/22 23:03:47 espie Exp $
@comment $OpenBSD: PLIST,v 1.5 2006/09/22 05:56:25 pvalchev Exp $
bin/achfile
bin/acleandir.rc
bin/add_netatalk_printer
bin/adv1tov2
bin/aecho
bin/afile
@ -10,30 +9,33 @@ bin/afppasswd
bin/apple_cp
bin/apple_mv
bin/apple_rm
bin/asip-status.pl
bin/binheader
bin/cleanappledouble.pl
bin/cnid2_create
bin/cnid_index
bin/cnid_maint
bin/getzones
bin/hqx2bin
bin/lp2pap.sh
bin/macbinary
bin/macusers
bin/makecode
bin/megatron
bin/nadheader
bin/nbplkup
bin/nbprgstr
bin/nbpunrgstr
bin/netatalk-config
bin/netatalkshorternamelinks.pl
bin/nu
bin/pap
bin/papstatus
bin/parsecode
bin/psorder
bin/showppd
bin/single2bin
bin/timeout
bin/unbin
bin/unhex
bin/uniconv
bin/unsingle
include/atalk/
include/atalk/adouble.h
@ -46,6 +48,7 @@ include/atalk/cnid.h
include/atalk/compat.h
include/atalk/ddp.h
include/atalk/dsi.h
include/atalk/list.h
include/atalk/logger.h
include/atalk/nbp.h
include/atalk/netddp.h
@ -53,20 +56,16 @@ include/atalk/pap.h
include/atalk/paths.h
include/atalk/rtmp.h
include/atalk/server_child.h
include/atalk/tdb.h
include/atalk/uam.h
include/atalk/unicode.h
include/atalk/util.h
include/atalk/zip.h
include/netatalk/
include/netatalk/aarp.c
include/netatalk/aarp.h
include/netatalk/at.h
include/netatalk/at_control.c
include/netatalk/at_proto.c
include/netatalk/at_var.h
include/netatalk/ddp.h
include/netatalk/ddp_input.c
include/netatalk/ddp_output.c
include/netatalk/ddp_usrreq.c
include/netatalk/ddp_var.h
include/netatalk/endian.h
include/netatalk/phase2.h
@ -88,6 +87,29 @@ lib/netatalk/uams/uams_passwd.so
lib/netatalk/uams/uams_randnum.a
lib/netatalk/uams/uams_randnum.la
lib/netatalk/uams/uams_randnum.so
libexec/etc2ps.sh
libexec/ifmpap
libexec/ifmpaprev
libexec/ifpap
libexec/ifpaprev
libexec/ifwmpap
libexec/ifwmpaprev
libexec/ifwpap
libexec/ifwpaprev
libexec/ofmpap
libexec/ofpap
libexec/ofwmpap
libexec/ofwpap
libexec/psa
libexec/psf
libexec/tfmpap
libexec/tfmpaprev
libexec/tfpap
libexec/tfpaprev
libexec/tfwmpap
libexec/tfwmpaprev
libexec/tfwpap
libexec/tfwpaprev
@man man/man1/achfile.1
@man man/man1/acleandir.1
@man man/man1/aecho.1
@ -96,6 +118,8 @@ lib/netatalk/uams/uams_randnum.so
@man man/man1/apple_cp.1
@man man/man1/apple_mv.1
@man man/man1/apple_rm.1
@man man/man1/asip-status.pl.1
@man man/man1/cnid_index.1
@man man/man1/getzones.1
@man man/man1/hqx2bin.1
@man man/man1/macbinary.1
@ -112,6 +136,7 @@ lib/netatalk/uams/uams_randnum.so
@man man/man1/timeout.1
@man man/man1/unbin.1
@man man/man1/unhex.1
@man man/man1/uniconv.1
@man man/man1/unsingle.1
@man man/man3/atalk_aton.3
@man man/man3/nbp_name.3
@ -123,73 +148,46 @@ lib/netatalk/uams/uams_randnum.so
@man man/man5/papd.conf.5
@man man/man8/afpd.8
@man man/man8/atalkd.8
@man man/man8/cnid_dbd.8
@man man/man8/cnid_metad.8
@man man/man8/papd.8
@man man/man8/papstatus.8
@man man/man8/psf.8
@man man/man8/timelord.8
sbin/afpd
sbin/atalkd
sbin/etc2ps.sh
sbin/ifmpap
sbin/ifmpaprev
sbin/ifpap
sbin/ifpaprev
sbin/ifwmpap
sbin/ifwmpaprev
sbin/ifwpap
sbin/ifwpaprev
sbin/ofmpap
sbin/ofpap
sbin/ofwmpap
sbin/ofwpap
sbin/cnid_dbd
sbin/cnid_metad
sbin/papd
sbin/psa
sbin/psf
sbin/tfmpap
sbin/tfmpaprev
sbin/tfpap
sbin/tfpaprev
sbin/tfwmpap
sbin/tfwmpaprev
sbin/tfwpap
sbin/tfwpaprev
share/aclocal/
share/aclocal/netatalk.m4
share/doc/netatalk/
share/doc/netatalk/COPYING
share/doc/netatalk/COPYRIGHT
share/doc/netatalk/FAQ
share/doc/netatalk/Netatalk-Manual.pdf
share/doc/netatalk/Netatalk-Manual.txt
share/doc/netatalk/README.hidden-items
share/doc/netatalk/README.ids
share/doc/netatalk/README.logger
share/doc/netatalk/README.platforms
share/doc/netatalk/README.veto
share/examples/netatalk/
@mode 750
@sample ${CONFDIR}/
@mode
@sample /etc/netatalk/
@mode 640
share/examples/netatalk/AppleVolumes.default
@sample ${CONFDIR}/AppleVolumes.default
@sample /etc/netatalk/AppleVolumes.default
share/examples/netatalk/AppleVolumes.system
@sample ${CONFDIR}/AppleVolumes.system
@sample /etc/netatalk/AppleVolumes.system
share/examples/netatalk/afpd.conf
@sample ${CONFDIR}/afpd.conf
@sample /etc/netatalk/afpd.conf
share/examples/netatalk/atalkd.conf
@sample ${CONFDIR}/atalkd.conf
@sample /etc/netatalk/atalkd.conf
share/examples/netatalk/netatalk.conf
@sample ${CONFDIR}/netatalk.conf
@sample /etc/netatalk/netatalk.conf
share/examples/netatalk/papd.conf
@sample ${CONFDIR}/papd.conf
share/examples/netatalk/rc.atalk
@sample ${CONFDIR}/rc.atalk
@sample /etc/netatalk/papd.conf
share/examples/netatalk/rc.atalk.bsd
@sample /etc/netatalk/rc.atalk
share/netatalk/
share/netatalk/pagecount.ps
share/nls/netatalk/
@sample ${CONFDIR}/nls/
share/nls/netatalk/maccode.437
@sample ${CONFDIR}/nls/maccode.437
share/nls/netatalk/maccode.850
@sample ${CONFDIR}/nls/maccode.850
share/nls/netatalk/maccode.iso8859-1
@sample ${CONFDIR}/nls/maccode.iso8859-1
share/nls/netatalk/maccode.iso8859-1.adapted
@sample ${CONFDIR}/nls/maccode.iso8859-1.adapted
share/nls/netatalk/maccode.koi8-r
@sample ${CONFDIR}/nls/maccode.koi8-r

View File

@ -1,71 +0,0 @@
# $OpenBSD: Makefile,v 1.9 2006/07/28 20:17:52 sturm Exp $
COMMENT= "AFP file and print services for AppleTalk/IP networks"
DISTNAME= netatalk-1.6.3
PKGNAME= ${DISTNAME}p3
CATEGORIES= net
HOMEPAGE= http://netatalk.sourceforge.net/
# According to http://netatalk.sourceforge.net/
# now under GPL but the copyright shipping with
# the distribution is still BSD. What gives?
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
WANTLIB= c crypto des rpcsvc
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=netatalk/}
SEPARATE_BUILD= concurrent
CONFIGURE_STYLE= gnu
CONFDIR= ${SYSCONFDIR}/netatalk
SUBST_VARS= CONFDIR
# Experimantal at the moment.
# LIB_DEPENDS= db.3::databases/db
# CONFIGURE_ARGS+= --with-db3=${LOCALBASE}
CONFIGURE_ARGS+= ${CONFIGURE_SHARED}
CONFIGURE_ARGS+= --with-ssl=/usr
CONFIGURE_ARGS+= --with-config-dir=${CONFDIR}
CONFIGURE_ARGS+= --with-pkgconfdir=${CONFDIR}
CONFIGURE_ARGS+= --with-uams-path=${PREFIX}/lib/netatalk/uams
CONFIGURE_ARGS+= --with-tcp-wrappers
CONFIGURE_ARGS+= --disable-overwrite
CONFIGURE_ARGS+= --with-did=last
post-patch:
@cp /usr/include/netatalk/*.h ${WRKSRC}/sys/netatalk
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/netatalk
${INSTALL_DATA_DIR} ${PREFIX}/share/nls/netatalk
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/netatalk
.for i in AppleVolumes.default AppleVolumes.system \
atalkd.conf papd.conf netatalk.conf
${INSTALL_DATA} ${WRKSRC}/config/$i \
${PREFIX}/share/examples/netatalk
.endfor
${INSTALL_DATA} ${WRKBUILD}/config/afpd.conf \
${PREFIX}/share/examples/netatalk
${INSTALL_DATA} ${WRKBUILD}/distrib/initscripts/rc.atalk.bsd \
${PREFIX}/share/examples/netatalk/rc.atalk
${INSTALL_DATA} ${WRKBUILD}/etc/afpd/nls/maccode.* \
${PREFIX}/share/nls/netatalk
${INSTALL_DATA} ${WRKSRC}/COPYRIGHT \
${PREFIX}/share/doc/netatalk
.for i in FAQ README.hidden-items \
README.platforms README.veto
${INSTALL_DATA} ${WRKSRC}/doc/$i \
${PREFIX}/share/doc/netatalk
.endfor
.include <bsd.port.mk>

View File

@ -1,4 +0,0 @@
MD5 (netatalk-1.6.3.tar.gz) = 3d07c07352e1173534ca5fbce457141f
RMD160 (netatalk-1.6.3.tar.gz) = c7f943cf55c96e06cc1e9d7bfd69b481fa6b9226
SHA1 (netatalk-1.6.3.tar.gz) = d2d832d81f2fa5a314c244c3b869a55d463b3ddb
SIZE (netatalk-1.6.3.tar.gz) = 924785

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-bin_adv1tov2_adv1tov2_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- bin/adv1tov2/adv1tov2.c.orig Mon Aug 18 13:33:27 2003
+++ bin/adv1tov2/adv1tov2.c Mon Aug 18 13:34:29 2003
@@ -28,7 +28,7 @@
/* translate characters */
static int xlate(char *name, int flags) {
static const char hexdig[] = "0123456789abcdef";
- char upath[MAXPATHLEN + 1];
+ char upath[MAXPATHLEN];
char *m, *u;
int doit = 0;

View File

@ -1,24 +0,0 @@
$OpenBSD: patch-bin_afppasswd_afppasswd_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- bin/afppasswd/afppasswd.c.orig Mon Aug 18 13:35:13 2003
+++ bin/afppasswd/afppasswd.c Mon Aug 18 13:39:17 2003
@@ -78,7 +78,7 @@ char *strchr (), *strrchr ();
#define HEXPASSWDLEN 16
#define PASSWDLEN 8
-static char buf[MAXPATHLEN + 1];
+static char buf[MAXPATHLEN];
/* if newpwd is null, convert buf from hex to binary. if newpwd isn't
* null, convert newpwd to hex and save it in buf. */
@@ -142,9 +142,9 @@ static int update_passwd(const char *pat
}
/* open the key file if it exists */
- strcpy(buf, path);
+ (void)strlcpy(buf, path, sizeof(buf));
if (strlen(path) < sizeof(buf) - 5) {
- strcat(buf, ".key");
+ (void)strlcat(buf, ".key", sizeof(buf));
keyfd = open(buf, O_RDONLY);
}

View File

@ -1,21 +0,0 @@
$OpenBSD: patch-bin_megatron_asingle_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- bin/megatron/asingle.c.orig Mon Aug 18 13:40:09 2003
+++ bin/megatron/asingle.c Mon Aug 18 13:42:54 2003
@@ -49,7 +49,7 @@
*/
struct single_file_data {
int filed;
- char path[ MAXPATHLEN + 1];
+ char path[MAXPATHLEN];
struct ad_entry entry[ ADEID_MAX ];
} single;
@@ -76,7 +76,7 @@ int single_open( singlefile, flags, fh,
perror( singlefile );
return( -1 );
}
- strncpy( single.path, singlefile, MAXPATHLEN );
+ strncpy( single.path, singlefile, (MAXPATHLEN-1));
#if DEBUG
fprintf( stderr, "opened %s for read\n", single.path );
#endif /* DEBUG */

View File

@ -1,34 +0,0 @@
$OpenBSD: patch-bin_megatron_hqx_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- bin/megatron/hqx.c.orig Mon Apr 29 11:52:49 2002
+++ bin/megatron/hqx.c Mon Aug 18 14:02:17 2003
@@ -82,7 +82,7 @@ FILE *rawhex, *expandhex;
struct hqx_file_data {
u_int32_t forklen[ NUMFORKS ];
u_short forkcrc[ NUMFORKS ];
- char path[ MAXPATHLEN + 1];
+ char path[MAXPATHLEN];
u_short headercrc;
int filed;
} hqx;
@@ -105,7 +105,6 @@ int hqx_open( hqxfile, flags, fh, option
int flags, options;
struct FHeader *fh;
{
- int maxlen;
#if DEBUG
fprintf( stderr, "megatron: entering hqx_open\n" );
@@ -142,10 +141,9 @@ int hqx_open( hqxfile, flags, fh, option
fprintf( stderr, "%s\n", hqxfile );
return( -1 );
} else {
- maxlen = sizeof( hqx.path ) -1;
- strncpy( hqx.path, fh->name, maxlen );
- strncpy( hqx.path, mtoupath( hqx.path ), maxlen );
- strncat( hqx.path, ".hqx", maxlen - strlen( hqx.path ));
+ (void)strlcpy( hqx.path, fh->name, sizeof(hqx.path));
+ (void)strlcpy( hqx.path, mtoupath( hqx.path ), sizeof(hqx.path));
+ (void)strlcat( hqx.path, ".hqx", sizeof(hqx.path));
if (( hqx.filed = open( hqx.path, flags, 0666 )) < 0 ) {
perror( hqx.path );
return( -1 );

View File

@ -1,38 +0,0 @@
$OpenBSD: patch-bin_megatron_macbin_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- bin/megatron/macbin.c.orig Mon Aug 18 13:48:25 2003
+++ bin/megatron/macbin.c Mon Aug 18 13:53:26 2003
@@ -54,7 +54,7 @@
*/
struct bin_file_data {
u_int32_t forklen[ NUMFORKS ];
- char path[ MAXPATHLEN + 1];
+ char path[MAXPATHLEN];
int filed;
u_short headercrc;
time_t gmtoff; /* to convert from/to localtime */
@@ -74,7 +74,6 @@ int bin_open( binfile, flags, fh, option
int flags, options;
struct FHeader *fh;
{
- int maxlen;
int rc;
time_t t;
struct tm *tp;
@@ -112,14 +111,13 @@ int bin_open( binfile, flags, fh, option
if (options & OPTION_STDOUT)
bin.filed = fileno(stdout);
else {
- maxlen = sizeof( bin.path ) - 1;
#if DEBUG
fprintf( stderr, "sizeof bin.path\t\t\t%d\n", sizeof( bin.path ));
fprintf( stderr, "maxlen \t\t\t\t%d\n", maxlen );
#endif /* DEBUG */
- strncpy( bin.path, fh->name, maxlen );
- strncpy( bin.path, mtoupath( bin.path ), maxlen );
- strncat( bin.path, ".bin", maxlen - strlen( bin.path ));
+ (void)strlcpy( bin.path, fh->name,sizeof(bin.path));
+ (void)strlcpy( bin.path, mtoupath( bin.path ), sizeof(bin.path));
+ (void)strlcat( bin.path, ".bin", sizeof(bin.path));
if (( bin.filed = open( bin.path, flags, 0666 )) < 0 ) {
perror( bin.path );
return( -1 );

View File

@ -1,23 +0,0 @@
$OpenBSD: patch-bin_megatron_nad_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- bin/megatron/nad.c.orig Mon Aug 18 13:53:38 2003
+++ bin/megatron/nad.c Mon Aug 18 13:56:39 2003
@@ -27,7 +27,7 @@
static char hexdig[] = "0123456789abcdef";
-static char mtou_buf[MAXPATHLEN + 1], utom_buf[MAXPATHLEN + 1];
+static char mtou_buf[MAXPATHLEN], utom_buf[MAXPATHLEN];
static char *mtoupathcap( mpath )
char *mpath;
{
@@ -334,8 +334,8 @@ void select_charset( int options)
#endif /* HEXOUTPUT */
struct nad_file_data {
- char macname[ MAXPATHLEN + 1 ];
- char adpath[ 2 ][ MAXPATHLEN + 1];
+ char macname[MAXPATHLEN];
+ char adpath[ 2 ][MAXPATHLEN];
int offset[ NUMFORKS ];
struct adouble ad;
} nad;

View File

@ -1,30 +0,0 @@
$OpenBSD: patch-config_Makefile_in,v 1.2 2003/08/22 11:18:19 naddy Exp $
--- config/Makefile.in.orig Tue Jun 10 01:58:07 2003
+++ config/Makefile.in Mon Aug 18 11:19:55 2003
@@ -184,7 +184,7 @@ SUFFIXES = .tmpl .
GENFILES = afpd.conf
TMPLFILES = $(foreach file,$(GENFILES),$(file).tmpl)
CONFFILES = AppleVolumes.default AppleVolumes.system \
- atalkd.conf netatalk.conf papd.conf
+ netatalk.conf papd.conf
PAMFILES = netatalk.pamd
@@ -365,7 +365,16 @@ uninstall-am: uninstall-info-am
install-config-files: $(CONFFILES) $(GENFILES)
$(mkinstalldirs) $(DESTDIR)$(pkgconfdir)
- for f in $(CONFFILES) $(GENFILES); do \
+ for f in $(CONFFILES); do \
+ if test "x$(OVERWRITE_CONFIG)" = "xyes" -o ! -f $(DESTDIR)$(pkgconfdir)/$$f; then \
+ echo "$(INSTALL_DATA) $$f $(DESTDIR)$(pkgconfdir)"; \
+ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(pkgconfdir); \
+ else \
+ echo "not overwriting $$f"; \
+ fi; \
+ done
+
+ for f in $(GENFILES); do \
if test "x$(OVERWRITE_CONFIG)" = "xyes" -o ! -f $(DESTDIR)$(pkgconfdir)/$$f; then \
echo "$(INSTALL_DATA) $$f $(DESTDIR)$(pkgconfdir)"; \
$(INSTALL_DATA) $$f $(DESTDIR)$(pkgconfdir); \

View File

@ -1,21 +0,0 @@
$OpenBSD: patch-configure,v 1.2 2003/08/22 11:18:19 naddy Exp $
--- configure.orig Tue Jun 10 01:55:15 2003
+++ configure Mon Aug 18 11:18:16 2003
@@ -14515,10 +14515,16 @@ echo "${ECHO_T} * OpenBSD specific confi
#define BSD4_4 1
_ACEOF
- cat >>confdefs.h <<\_ACEOF
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ # Use the same ELF test as for NetBSD here for OpenBSD
+ # NetBSD ELF machines don't have to have DLSYM_PREPEND_UNDERSCO$
+ # If this test is true, it's not an ELF box.
+ # This REALLY should be a configure test.
+ cat >>confdefs.h <<\_ACEOF
#define DLSYM_PREPEND_UNDERSCORE 1
_ACEOF
+ fi
cat >>confdefs.h <<\_ACEOF
#define UAM_DHX 1

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-etc_afpd_appl_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- etc/afpd/appl.c.orig Mon Aug 18 14:48:02 2003
+++ etc/afpd/appl.c Mon Aug 18 14:48:47 2003
@@ -396,7 +396,7 @@ int ibuflen, *rbuflen;
#define hextoint( c ) ( isdigit( c ) ? c - '0' : c + 10 - 'a' )
#define islxdigit(x) (!isupper(x)&&isxdigit(x))
- char utomname[ MAXPATHLEN + 1];
+ char utomname[MAXPATHLEN];
char *u, *m;
int i, h;

View File

@ -1,29 +0,0 @@
$OpenBSD: patch-etc_afpd_auth_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- etc/afpd/auth.c.orig Mon Aug 18 14:48:54 2003
+++ etc/afpd/auth.c Mon Aug 18 14:51:43 2003
@@ -530,7 +530,7 @@ int auth_register(const int type, struct
/* load all of the modules */
int auth_load(const char *path, const char *list)
{
- char name[MAXPATHLEN + 1], buf[MAXPATHLEN + 1], *p;
+ char name[MAXPATHLEN], buf[MAXPATHLEN], *p;
struct uam_mod *mod;
struct stat st;
size_t len;
@@ -538,13 +538,13 @@ int auth_load(const char *path, const ch
if (!path || !*path || !list || (len = strlen(path)) > sizeof(name) - 2)
return -1;
- strncpy(buf, list, sizeof(buf));
+ (void)strlcpy(buf, list, sizeof(buf));
if ((p = strtok(buf, ",")) == NULL)
return -1;
- strcpy(name, path);
+ (void)strlcpy(name, path, sizeof(name));
if (name[len - 1] != '/') {
- strcat(name, "/");
+ (void)strlcat(name, "/", sizeof(name));
len++;
}

View File

@ -1,54 +0,0 @@
$OpenBSD: patch-etc_afpd_desktop_c,v 1.2 2003/08/22 11:18:19 naddy Exp $
--- etc/afpd/desktop.c.orig Tue Nov 26 13:57:58 2002
+++ etc/afpd/desktop.c Mon Aug 18 15:15:32 2003
@@ -572,12 +572,12 @@ geticon_exit:
static char hexdig[] = "0123456789abcdef";
char *dtfile(const struct vol *vol, u_char creator[], char *ext )
{
- static char path[ MAXPATHLEN + 1];
+ static char path[MAXPATHLEN];
char *p;
int i;
- strcpy( path, vol->v_path );
- strcat( path, "/.AppleDesktop/" );
+ (void)strlcpy( path, vol->v_path, sizeof(path));
+ (void)strlcat( path, "/.AppleDesktop/", sizeof(path));
for ( p = path; *p != '\0'; p++ )
;
@@ -599,14 +599,14 @@ char *dtfile(const struct vol *vol, u_ch
}
}
*p = '\0';
- strcat( path, ext );
+ (void)strlcat(path, ext, sizeof(path));
return( path );
}
char *mtoupath(const struct vol *vol, char *mpath)
{
- static char upath[ MAXPATHLEN + 1];
+ static char upath[MAXPATHLEN];
char *m, *u;
int i = 0;
@@ -681,7 +681,7 @@ char *mtoupath(const struct vol *vol, ch
char *utompath(const struct vol *vol, char *upath)
{
- static char mpath[ MAXPATHLEN + 1];
+ static char mpath[MAXPATHLEN];
char *m, *u;
int h;
@@ -718,7 +718,7 @@ char *utompath(const struct vol *vol, ch
*m = '\0';
#ifdef FILE_MANGLING
- strcpy(mpath,mangle(vol, mpath));
+ (void)strlcpy(mpath,mangle(vol, mpath),sizeof(mpath));
#endif /* FILE_MANGLING */
#ifdef DEBUG

View File

@ -1,99 +0,0 @@
$OpenBSD: patch-etc_afpd_file_c,v 1.3 2003/08/22 11:18:19 naddy Exp $
--- etc/afpd/file.c.orig Tue Jun 10 00:53:15 2003
+++ etc/afpd/file.c Mon Aug 18 15:06:08 2003
@@ -161,15 +161,15 @@ int getmetadata(struct vol *vol,
} else {
aint = AD_DATE_FROM_UNIX(st->st_mtime);
}
- memcpy(data, &aint, sizeof( int ));
- data += sizeof( int );
+ memcpy(data, &aint, sizeof( aint ));
+ data += sizeof( aint );
break;
case FILPBIT_BDATE :
if (!adp || (ad_getdate(adp, AD_DATE_BACKUP, &aint) < 0))
aint = AD_DATE_START;
- memcpy(data, &aint, sizeof( int ));
- data += sizeof( int );
+ memcpy(data, &aint, sizeof( aint ));
+ data += sizeof( aint );
break;
case FILPBIT_FINFO :
@@ -597,7 +597,7 @@ int setfilparams(struct vol *vol,
int change_mdate = 0;
int change_parent_mdate = 0;
- int newdate = 0;
+ u_int32_t newdate = 0;
struct timeval tv;
@@ -788,7 +788,7 @@ char *src, *dst, *newname;
const int noadouble;
struct adouble *adp;
{
- char adsrc[ MAXPATHLEN + 1];
+ char adsrc[MAXPATHLEN];
int len, rc;
/*
@@ -824,7 +824,7 @@ struct adouble *adp;
}
}
- strcpy( adsrc, ad_path( src, 0 ));
+ (void)strlcpy(adsrc, ad_path( src, 0 ), sizeof(adsrc));
rc = 0;
rename_retry:
if (rename( adsrc, ad_path( dst, 0 )) < 0 ) {
@@ -1034,13 +1034,13 @@ const int noadouble;
char filebuf[8192];
int sfd, dfd, len, err = AFP_OK;
ssize_t cc;
- char dpath[ MAXPATHLEN + 1];
+ char dpath[MAXPATHLEN];
int admode;
#ifdef DEBUG
LOG(log_info, logtype_afpd, "begin copyfile:");
#endif /* DEBUG */
- strcpy(dpath, ad_path( dst, ADFLAGS_HF ));
+ (void)strlcpy(dpath, ad_path( dst, ADFLAGS_HF ), sizeof(dpath));
admode = ad_mode( dst, 0666 );
if (newname) {
if ((sfd = open( ad_path( src, ADFLAGS_HF ), O_RDONLY, 0 )) < 0 ) {
@@ -1374,7 +1374,7 @@ int ibuflen, *rbuflen;
char *path, *upath;
int len;
cnid_t did, id;
- u_short vid;
+ u_int16_t vid;
#ifdef DEBUG
LOG(log_info, logtype_afpd, "begin afp_createid:");
@@ -1473,8 +1473,8 @@ int ibuflen, *rbuflen;
cnid_t id;
u_int16_t vid, bitmap;
- static char buffer[12 + MAXPATHLEN + 1];
- int len = 12 + MAXPATHLEN + 1;
+ static char buffer[12 + MAXPATHLEN];
+ int len = 12 + MAXPATHLEN;
#ifdef DEBUG
LOG(log_info, logtype_afpd, "begin afp_resolveid:");
@@ -1546,9 +1546,9 @@ int ibuflen, *rbuflen;
int err;
cnid_t id;
cnid_t fileid;
- u_short vid;
- static char buffer[12 + MAXPATHLEN + 1];
- int len = 12 + MAXPATHLEN + 1;
+ u_int16_t vid;
+ static char buffer[12 + MAXPATHLEN];
+ int len = 12 + MAXPATHLEN;
#ifdef DEBUG
LOG(log_info, logtype_afpd, "begin afp_deleteid:");

View File

@ -1,21 +0,0 @@
$OpenBSD: patch-etc_afpd_quota_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- etc/afpd/quota.c.orig Mon Aug 18 15:08:13 2003
+++ etc/afpd/quota.c Mon Aug 18 15:09:37 2003
@@ -312,7 +312,7 @@ const u_int32_t bsize;
char *p;
#ifdef __svr4__
- char buf[ MAXPATHLEN + 1];
+ char buf[MAXPATHLEN];
if ( vol->v_qfd == -1 && vol->v_gvs == NULL) {
if (( p = mountp( vol->v_path, &vol->v_nfs)) == NULL ) {
@@ -328,7 +328,7 @@ const u_int32_t bsize;
strcpy( vol->v_gvs, p );
} else {
- sprintf( buf, "%s/quotas", p );
+ snprintf( buf, sizeof(buf), "%s/quotas", p );
if (( vol->v_qfd = open( buf, O_RDONLY, 0 )) < 0 ) {
LOG(log_info, logtype_afpd, "open %s: %s", buf, strerror(errno) );
return( AFPERR_PARAM );

View File

@ -1,22 +0,0 @@
$OpenBSD: patch-etc_afpd_uam_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- etc/afpd/uam.c.orig Mon Aug 18 15:09:58 2003
+++ etc/afpd/uam.c Mon Aug 18 15:11:17 2003
@@ -68,7 +68,7 @@ char *strchr (), *strrchr ();
/* uam_load. uams must have a uam_setup function. */
struct uam_mod *uam_load(const char *path, const char *name)
{
- char buf[MAXPATHLEN + 1], *p;
+ char buf[MAXPATHLEN], *p;
struct uam_mod *mod;
void *module;
@@ -82,8 +82,7 @@ struct uam_mod *uam_load(const char *pat
goto uam_load_fail;
}
- strncpy(buf, name, sizeof(buf));
- buf[sizeof(buf) - 1] = '\0';
+ (void)strlcpy(buf, name, sizeof(buf));
if ((p = strchr(buf, '.')))
*p = '\0';
if ((mod->uam_fcn = mod_symbol(module, buf)) == NULL) {

View File

@ -1,119 +0,0 @@
$OpenBSD: patch-etc_afpd_unix_c,v 1.2 2003/08/22 11:18:19 naddy Exp $
--- etc/afpd/unix.c.orig Mon Aug 18 14:38:03 2003
+++ etc/afpd/unix.c Mon Aug 18 14:47:24 2003
@@ -289,7 +289,7 @@ const int dropbox;
int setdeskmode( mode )
const mode_t mode;
{
- char wd[ MAXPATHLEN + 1];
+ char wd[MAXPATHLEN];
struct stat st;
char modbuf[ 12 + 1], *m;
struct dirent *deskp, *subp;
@@ -312,8 +312,8 @@ const mode_t mode;
strcmp( deskp->d_name, ".." ) == 0 || strlen( deskp->d_name ) > 2 ) {
continue;
}
- strcpy( modbuf, deskp->d_name );
- strcat( modbuf, "/" );
+ (void)strlcpy(modbuf, deskp->d_name, sizeof(modbuf));
+ (void)strlcat(modbuf, "/", sizeof(modbuf));
m = strchr( modbuf, '\0' );
if (( sub = opendir( deskp->d_name )) == NULL ) {
continue;
@@ -324,7 +324,7 @@ const mode_t mode;
continue;
}
*m = '\0';
- strcat( modbuf, subp->d_name );
+ (void)strlcat( modbuf, subp->d_name, sizeof(modbuf));
/* XXX: need to preserve special modes */
if (stat(modbuf, &st) < 0) {
LOG(log_error, logtype_afpd, "setdeskmode: stat %s: %s",
@@ -388,7 +388,7 @@ const mode_t mode;
const int noadouble;
const int dropbox;
{
- char buf[ MAXPATHLEN + 1];
+ char buf[MAXPATHLEN];
struct stat st;
char *m;
struct dirent *dirp;
@@ -436,8 +436,8 @@ const int dropbox;
LOG(log_error, logtype_afpd, "setdirmode: opendir .AppleDouble: %s", strerror(errno) );
return( -1 );
}
- strcpy( buf, ".AppleDouble" );
- strcat( buf, "/" );
+ (void)strlcpy(buf, ".AppleDouble", sizeof(buf));
+ (void)strlcat(buf, "/" ,sizeof(buf));
m = strchr( buf, '\0' );
for ( dirp = readdir( dir ); dirp != NULL; dirp = readdir( dir )) {
if ( strcmp( dirp->d_name, "." ) == 0 ||
@@ -445,7 +445,7 @@ const int dropbox;
continue;
}
*m = '\0';
- strcat( buf, dirp->d_name );
+ (void)strlcat(buf, dirp->d_name, sizeof(buf));
if ( stat( buf, &st ) < 0 ) {
LOG(log_error, logtype_afpd, "setdirmode: stat %s: %s", buf, strerror(errno) );
@@ -476,7 +476,7 @@ int setdeskowner( uid, gid )
const uid_t uid;
const gid_t gid;
{
- char wd[ MAXPATHLEN + 1];
+ char wd[MAXPATHLEN];
char modbuf[12 + 1], *m;
struct dirent *deskp, *subp;
DIR *desk, *sub;
@@ -499,8 +499,8 @@ const gid_t gid;
strlen( deskp->d_name ) > 2 ) {
continue;
}
- strcpy( modbuf, deskp->d_name );
- strcat( modbuf, "/" );
+ (void)strlcpy(modbuf, deskp->d_name, sizeof(modbuf));
+ (void)strlcat(modbuf, "/", sizeof(modbuf));
m = strchr( modbuf, '\0' );
if (( sub = opendir( deskp->d_name )) == NULL ) {
continue;
@@ -511,7 +511,7 @@ const gid_t gid;
continue;
}
*m = '\0';
- strcat( modbuf, subp->d_name );
+ (void)strlcat(modbuf, subp->d_name, sizeof(modbuf));
/* XXX: add special any uid, ignore group bits */
if ( chown( modbuf, uid, gid ) < 0 && errno != EPERM ) {
LOG(log_error, logtype_afpd, "setdeskown: chown %s: %s",
@@ -547,7 +547,7 @@ const uid_t uid;
const gid_t gid;
const int noadouble;
{
- char buf[ MAXPATHLEN + 1];
+ char buf[MAXPATHLEN];
struct stat st;
char *m;
struct dirent *dirp;
@@ -579,8 +579,8 @@ const int noadouble;
goto setdirowner_noadouble;
return( -1 );
}
- strcpy( buf, ".AppleDouble" );
- strcat( buf, "/" );
+ (void)strlcpy(buf, ".AppleDouble", sizeof(buf));
+ (void)strlcat(buf, "/", sizeof(buf));
m = strchr( buf, '\0' );
for ( dirp = readdir( dir ); dirp != NULL; dirp = readdir( dir )) {
if ( strcmp( dirp->d_name, "." ) == 0 ||
@@ -588,7 +588,7 @@ const int noadouble;
continue;
}
*m = '\0';
- strcat( buf, dirp->d_name );
+ (void)strlcat(buf, dirp->d_name, sizeof(buf));
if ( chown( buf, uid, gid ) < 0 && errno != EPERM ) {
LOG(log_debug, logtype_afpd, "setdirowner: chown %d/%d %s: %s",
uid, gid, buf, strerror(errno) );

View File

@ -1,56 +0,0 @@
$OpenBSD: patch-etc_afpd_volume_c,v 1.3 2003/08/22 11:18:19 naddy Exp $
--- etc/afpd/volume.c.orig Mon Aug 18 14:32:40 2003
+++ etc/afpd/volume.c Mon Aug 18 14:37:44 2003
@@ -385,11 +385,11 @@ static void volset(struct vol_option *op
#ifdef CNID_DB
} else if (optionok(tmp, "dbpath:", val)) {
- char t[MAXPATHLEN + 1];
+ char t[MAXPATHLEN];
if (options[VOLOPT_DBPATH].c_value)
free(options[VOLOPT_DBPATH].c_value);
- volxlate(obj, t, MAXPATHLEN, val, pwd, NULL);
+ volxlate(obj, t, (MAXPATHLEN-1), val, pwd, NULL);
options[VOLOPT_DBPATH].c_value = strdup(t + 1);
#endif /* CNID_DB */
} else if (optionok(tmp, "umask:", val)) {
@@ -571,13 +571,13 @@ static int accessvol(args, name)
const char *args;
const char *name;
{
- char buf[MAXPATHLEN + 1], *p;
+ char buf[MAXPATHLEN], *p;
struct group *gr;
if (!args)
return -1;
- strncpy(buf, args, sizeof(buf));
+ (void)strlcpy(buf, args, sizeof(buf));
if ((p = strtok(buf, ",")) == NULL) /* nothing, return okay */
return -1;
@@ -688,7 +688,7 @@ int user;
struct passwd *pwent;
{
FILE *fp;
- char path[ MAXPATHLEN + 1], tmp[ MAXPATHLEN + 1],
+ char path[MAXPATHLEN], tmp[MAXPATHLEN],
volname[ AFPVOL_NAMELEN + 1 ], buf[ BUFSIZ ],
type[ 5 ], creator[ 5 ];
char *u, *p;
@@ -699,10 +699,10 @@ struct passwd *pwent;
if (!p1)
return -1;
- strcpy( path, p1 );
+ (void)strlcpy(path, p1, sizeof(path));
if ( p2 != NULL ) {
- strcat( path, "/" );
- strcat( path, p2 );
+ (void)strlcat(path, "/", sizeof(path));
+ (void)strlcat( path, p2, sizeof(path));
}
if (NULL == ( fp = fopen( path, "r" )) ) {

View File

@ -1,55 +0,0 @@
$OpenBSD: patch-etc_atalkd_config_c,v 1.2 2003/08/22 11:18:19 naddy Exp $
--- etc/atalkd/config.c.orig Wed Mar 19 10:39:30 2003
+++ etc/atalkd/config.c Mon Aug 18 14:22:49 2003
@@ -202,9 +202,10 @@ int writeconf( cf )
}
if (( p = strrchr( path, '/' )) == NULL ) {
- strcpy( newpath, _PATH_ATALKDTMP );
+ (void)strlcpy( newpath, _PATH_ATALKDTMP,sizeof(newpath));
} else {
- sprintf( newpath, "%.*s/%s", (int)(p - path), path, _PATH_ATALKDTMP );
+ snprintf( newpath,sizeof(newpath), "%.*s/%s", (int)(p - path),
+ path, _PATH_ATALKDTMP );
}
if (( fd = open( newpath, O_WRONLY|O_CREAT|O_TRUNC, mode )) < 0 ) {
LOG(log_error, logtype_atalkd, "%s: %s", newpath, strerror(errno) );
@@ -336,8 +337,7 @@ int readconf( cf )
* 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';
+ (void)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)) {
@@ -546,7 +546,7 @@ int net( iface, av )
stop++;
}
net = atoi( nrange );
- if ( net < 0 || net >= 0xffff ) {
+ if ( net < 1 || net >= 0xffff ) {
fprintf( stderr, "Bad network: %d\n", net );
return -1;
}
@@ -780,7 +780,7 @@ struct interface *newiface( name )
int plumb()
{
struct interface *iface;
- char device[ MAXPATHLEN + 1], *p;
+ char device[MAXPATHLEN], *p;
int fd, ppa;
for ( iface = interfaces; iface != NULL; iface = iface->i_next ) {
@@ -788,8 +788,8 @@ int plumb()
continue;
}
- strcpy( device, "/dev/" );
- strcat( device, iface->i_name );
+ (void)strlcpy(device, "/dev/", sizef(device));
+ (void)strlcat(device, iface->i_name, sizeof(device));
if (( p = strpbrk( device, "0123456789" )) == NULL ) {
LOG(log_error, logtype_atalkd, "plumb: invalid device: %s", device );
return -1;

View File

@ -1,37 +0,0 @@
$OpenBSD: patch-etc_atalkd_main_c,v 1.2 2003/08/22 11:18:19 naddy Exp $
--- etc/atalkd/main.c.orig Sat Oct 5 23:20:13 2002
+++ etc/atalkd/main.c Fri Jan 3 03:51:16 2003
@@ -278,12 +278,12 @@ static void as_timer(int sig)
LOG(log_info, logtype_atalkd, "config for no router" );
if ( iface->i_flags & IFACE_PHASE2 ) {
- iface->i_rt->rt_firstnet = 0;
+ iface->i_rt->rt_firstnet = htons(1);
iface->i_rt->rt_lastnet = htons( STARTUP_LASTNET );
setaddr( iface, IFACE_PHASE2,
iface->i_addr.sat_addr.s_net,
iface->i_addr.sat_addr.s_node,
- 0, htons( STARTUP_LASTNET ));
+ htons(1), htons( STARTUP_LASTNET ));
}
if ( looproute( iface, RTMP_ADD ) ) { /* -1 or 1 */
LOG(log_error, logtype_atalkd,
@@ -376,15 +376,15 @@ static void as_timer(int sig)
LOG(log_info, logtype_atalkd, "as_timer last gateway down" );
- /* Set netrange to 0-fffe. */
+ /* Set netrange to 1-fffe. */
if ( gate->g_iface->i_flags & IFACE_PHASE2 ) {
- gate->g_iface->i_rt->rt_firstnet = 0;
+ gate->g_iface->i_rt->rt_firstnet = htons(1);
gate->g_iface->i_rt->rt_lastnet =
htons( STARTUP_LASTNET );
setaddr( iface, IFACE_PHASE2,
iface->i_addr.sat_addr.s_net,
iface->i_addr.sat_addr.s_node,
- 0, htons( STARTUP_LASTNET ));
+ htons(1), htons( STARTUP_LASTNET ));
}
}
continue;

View File

@ -1,29 +0,0 @@
$OpenBSD: patch-etc_papd_auth_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- etc/papd/auth.c.orig Mon Aug 18 14:27:33 2003
+++ etc/papd/auth.c Mon Aug 18 14:29:30 2003
@@ -96,7 +96,7 @@ int auth_register(const int type, struct
/* load all of the modules */
int auth_load(const char *path, const char *list)
{
- char name[MAXPATHLEN + 1], buf[MAXPATHLEN + 1], *p;
+ char name[MAXPATHLEN], buf[MAXPATHLEN], *p;
struct uam_mod *mod;
struct stat st;
int len;
@@ -104,13 +104,13 @@ int auth_load(const char *path, const ch
if (!path || !list || (len = strlen(path)) > sizeof(name) - 2)
return -1;
- strncpy(buf, list, sizeof(buf));
+ (void)strlcpy(buf, list, sizeof(buf));
if ((p = strtok(buf, ",")) == NULL)
return -1;
- strcpy(name, path);
+ (void)strlcpy(name, path, sizeof(name));
if (name[len - 1] != '/') {
- strcat(name, "/");
+ (void)strlcat(name, "/", sizeof(name));
len++;
}

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-etc_papd_uam_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- etc/papd/uam.c.orig Mon Aug 18 14:25:38 2003
+++ etc/papd/uam.c Mon Aug 18 14:27:07 2003
@@ -49,7 +49,7 @@ char *strchr (), *strrchr ();
/* uam_load. uams must have a uam_setup function. */
struct uam_mod *uam_load(const char *path, const char *name)
{
- char buf[MAXPATHLEN + 1], *p;
+ char buf[MAXPATHLEN], *p;
struct uam_mod *mod;
void *module;

View File

@ -1,17 +0,0 @@
$OpenBSD: patch-etc_psf_etc2ps_sh,v 1.1 2004/10/24 20:26:55 brad Exp $
--- etc/psf/etc2ps.sh.orig Sun Oct 24 16:20:53 2004
+++ etc/psf/etc2ps.sh Sun Oct 24 16:23:22 2004
@@ -26,9 +26,10 @@ case $1 in
#
df*)
if [ -x "$DVIPS" ]; then
- cat > /tmp/psfilter.$$
- $DVIPS $DVIPSARGS < /tmp/psfilter.$$
- rm -f /tmp/psfilter.$$
+ TEMPFILE=`mktemp -t psfilter.XXXXXXXXXX` || exit 1
+ cat > $TEMPFILE
+ $DVIPS $DVIPSARGS < $TEMPFILE
+ rm -f $TEMPFILE
else
echo "$0: filter dvips uninstalled" 1>&2
exit 2

View File

@ -1,53 +0,0 @@
$OpenBSD: patch-etc_uams_uams_randnum_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- etc/uams/uams_randnum.c.orig Mon Aug 18 14:04:44 2003
+++ etc/uams/uams_randnum.c Mon Aug 18 14:11:47 2003
@@ -149,7 +149,7 @@ static int afppasswd(const struct passwd
const int set)
{
u_int8_t key[DES_KEY_SZ*2];
- char buf[MAXPATHLEN + 1], *p;
+ char buf[MAXPATHLEN], *p;
Key_schedule schedule;
FILE *fp;
int i, j, keyfd = -1, err = 0;
@@ -161,9 +161,9 @@ static int afppasswd(const struct passwd
}
/* open the key file if it exists */
- strcpy(buf, path);
+ (void)strlcpy(buf, path, sizeof(buf));
if (pathlen < sizeof(buf) - 5) {
- strcat(buf, ".key");
+ (void)strlcat(buf, ".key", sizeof(buf));
keyfd = open(buf, O_RDONLY);
}
@@ -270,14 +270,14 @@ static int randpass(const struct passwd
/* Build pathname to user's '.passwd' file */
i = strlen(file);
if (*file == '~') {
- char path[MAXPATHLEN + 1];
+ char path[MAXPATHLEN];
- if ( (strlen(pwd->pw_dir) + i - 1) > MAXPATHLEN)
+ if ( (strlen(pwd->pw_dir) + i - 1) > (MAXPATHLEN-1))
return AFPERR_PARAM;
- strcpy(path, pwd->pw_dir );
- strcat(path, "/" );
- strcat(path, file + 2);
+ (void)strlcpy(path, pwd->pw_dir, sizeof(path));
+ (void)strlcat(path, "/", sizeof(path));
+ (void)strlcat(path, file + 2, sizeof(path));
if (!uid)
seteuid(pwd->pw_uid); /* change ourselves to the user */
i = home_passwd(pwd, path, i, passwd, len, set);
@@ -286,7 +286,7 @@ static int randpass(const struct passwd
return i;
}
- if (i > MAXPATHLEN)
+ if (i > (MAXPATHLEN-1))
return AFPERR_PARAM;
/* handle afppasswd file. we need to make sure that we're root

View File

@ -1,72 +0,0 @@
$OpenBSD: patch-include_atalk_paths_h,v 1.2 2003/08/22 11:18:19 naddy Exp $
--- include/atalk/paths.h.orig Wed Aug 1 05:51:12 2001
+++ include/atalk/paths.h Fri Jun 21 06:16:32 2002
@@ -16,65 +16,33 @@
/* lock file path. this should be re-organized a bit. */
#if ! defined (_PATH_LOCKDIR)
-# if defined (FHS_COMPATIBILITY)
# define _PATH_LOCKDIR "/var/run/"
-# elif defined (BSD4_4)
-# ifdef MACOSX_SERVER
-# define _PATH_LOCKDIR "/var/run/"
-# else
-# define _PATH_LOCKDIR "/var/spool/lock/"
-# endif
-# elif defined (linux)
-# define _PATH_LOCKDIR "/var/lock/"
-# else
-# define _PATH_LOCKDIR "/var/spool/locks/"
-# endif
#endif
/*
* papd paths
*/
#define _PATH_PAPDPRINTCAP "/etc/printcap"
-#ifdef ultrix
-#define _PATH_PAPDSPOOLDIR "/usr/spool/lpd"
-#else /* !ultrix */
#define _PATH_PAPDSPOOLDIR "/var/spool/lpd"
-#endif /* ultrix */
-#ifdef BSD4_4
#define _PATH_DEVPRINTER "/var/run/printer"
-#else /* !BSD4_4 */
-#define _PATH_DEVPRINTER "/dev/printer"
-#endif /* BSD4_4 */
/*
* atalkd paths
*/
#define _PATH_ATALKDEBUG "/tmp/atalkd.debug"
#define _PATH_ATALKDTMP "atalkd.tmp"
-#ifdef FHS_COMPATIBILITY
-# define _PATH_ATALKDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"atalkd.pid")
-#else
-# define _PATH_ATALKDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"atalkd")
-#endif
+#define _PATH_ATALKDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"atalkd.pid")
/*
* psorder paths
*/
#define _PATH_TMPPAGEORDER "/tmp/psorderXXXXXX"
-#ifdef FHS_COMPATIBILITY
-# define _PATH_PAPDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"papd.pid")
-#else
-# define _PATH_PAPDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"papd")
-#endif
+#define _PATH_PAPDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"papd.pid")
/*
* afpd paths
*/
#define _PATH_AFPTKT "/tmp/AFPtktXXXXXX"
-#ifdef FHS_COMPATIBILITY
-# define _PATH_AFPDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"afpd.pid")
-#else
-# define _PATH_AFPDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"afpd")
-#endif
+#define _PATH_AFPDLOCK ATALKPATHCAT(_PATH_LOCKDIR,"afpd.pid")
#endif /* atalk/paths.h */

View File

@ -1,23 +0,0 @@
$OpenBSD: patch-include_atalk_util_h,v 1.2 2003/08/22 11:18:19 naddy Exp $
--- include/atalk/util.h.orig Fri Feb 8 11:01:36 2002
+++ include/atalk/util.h Tue Jun 25 01:29:54 2002
@@ -39,12 +39,16 @@ extern void mod_close __P((void *));
#define RTLD_NOW 1
#endif /* ! RTLD_NOW */
-/* NetBSD doesn't like RTLD_NOW for dlopen (it fails). Use RTLD_LAZY. */
+/* NetBSD doesn't like RTLD_NOW for dlopen (it fails). Use RTLD_LAZY.
+ * OpenBSD currently does not use the second arg for dlopen(). For
+ * future compatibility we define DL_LAZY */
#ifdef __NetBSD__
#define mod_open(a) dlopen(a, RTLD_LAZY)
-#else /* ! __NetBSD__ */
+#elif defined(__OpenBSD__)
+#define mod_open(a) dlopen(a, DL_LAZY)
+#else /* ! __NetBSD__ || __OpenBSD__ */
#define mod_open(a) dlopen(a, RTLD_NOW)
-#endif /* __NetBSD__ */
+#endif /* __NetBSD__ __OpenBSD__ */
#ifndef DLSYM_PREPEND_UNDERSCORE
#define mod_symbol(a, b) dlsym(a, b)

View File

@ -1,63 +0,0 @@
$OpenBSD: patch-libatalk_adouble_ad_open_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- libatalk/adouble/ad_open.c.orig Mon Aug 18 12:59:47 2003
+++ libatalk/adouble/ad_open.c Mon Aug 18 13:04:54 2003
@@ -495,29 +495,29 @@ ad_path( path, adflags )
char *path;
int adflags;
{
- static char pathbuf[ MAXPATHLEN + 1];
- char c, *slash, buf[MAXPATHLEN + 1];
+ static char pathbuf[ MAXPATHLEN];
+ char c, *slash, buf[MAXPATHLEN];
- strncpy(buf, path, MAXPATHLEN);
+ strncpy(buf, path, (MAXPATHLEN-1));
if ( adflags & ADFLAGS_DIR ) {
- strncpy( pathbuf, buf, MAXPATHLEN );
+ strncpy( pathbuf, buf, (MAXPATHLEN-1));
if ( *buf != '\0' ) {
- strcat( pathbuf, "/" );
+ (void)strlcat( pathbuf, "/", sizeof(pathbuf));
}
slash = ".Parent";
} else {
if (( slash = strrchr( buf, '/' )) != NULL ) {
c = *++slash;
*slash = '\0';
- strncpy( pathbuf, buf, MAXPATHLEN);
+ strncpy( pathbuf, buf, (MAXPATHLEN-1));
*slash = c;
} else {
pathbuf[ 0 ] = '\0';
slash = buf;
}
}
- strncat( pathbuf, ".AppleDouble/", MAXPATHLEN - strlen(pathbuf));
- strncat( pathbuf, slash, MAXPATHLEN - strlen(pathbuf));
+ strncat( pathbuf, ".AppleDouble/", (MAXPATHLEN-1) - strlen(pathbuf));
+ strncat( pathbuf, slash, (MAXPATHLEN-1) - strlen(pathbuf));
return( pathbuf );
}
@@ -534,10 +534,10 @@ char
*ad_dir(path)
char *path;
{
- static char modebuf[ MAXPATHLEN + 1];
+ static char modebuf[MAXPATHLEN];
char *slash;
- if ( strlen( path ) >= MAXPATHLEN ) {
+ if ( strlen( path ) >= (MAXPATHLEN-1)) {
return NULL; /* can't do it */
}
@@ -546,7 +546,7 @@ char
* (path or subdirectory name) to get the name we want to stat.
* For a path which is just a filename, use "." instead.
*/
- strcpy( modebuf, path );
+ (void)strlcpy( modebuf, path, sizeof(modebuf));
if (( slash = strrchr( modebuf, '/' )) != NULL ) {
*slash = '\0'; /* remove pathname component */
} else {

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-libatalk_cnid_cnid_get_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- libatalk/cnid/cnid_get.c.orig Mon Aug 18 12:58:06 2003
+++ libatalk/cnid/cnid_get.c Mon Aug 18 12:58:56 2003
@@ -31,7 +31,7 @@ cnid_t cnid_get(void *CNID, const cnid_t
cnid_t id;
int rc;
- if (!(db = CNID) || (len > MAXPATHLEN)) {
+ if (!(db = CNID) || (len > (MAXPATHLEN-1))) {
return 0;
}

View File

@ -1,40 +0,0 @@
$OpenBSD: patch-libatalk_cnid_cnid_open_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- libatalk/cnid/cnid_open.c.orig Mon Aug 18 11:53:32 2003
+++ libatalk/cnid/cnid_open.c Mon Aug 18 12:56:38 2003
@@ -222,7 +222,7 @@ void *cnid_open(const char *dir, mode_t
#ifndef CNID_DB_CDB
struct flock lock;
#endif /* CNID_DB_CDB */
-char path[MAXPATHLEN + 1];
+char path[MAXPATHLEN];
CNID_private *db;
DBT key, data;
DB_TXN *tid;
@@ -246,13 +246,13 @@ char path[MAXPATHLEN + 1];
db->magic = CNID_DB_MAGIC;
- strcpy(path, dir);
+ (void)strlcpy(path, dir, sizeof(path));
if (path[len - 1] != '/') {
- strcat(path, "/");
+ (void)strlcat(path, "/", sizeof(path));
len++;
}
- strcpy(path + len, DBHOME);
+ (void)strlcpy(path + len, DBHOME, sizeof(path));
if ((stat(path, &st) < 0) && (ad_mkdir(path, 0777 & ~mask) < 0)) {
LOG(log_error, logtype_default, "cnid_open: DBHOME mkdir failed for %s", path);
goto fail_adouble;
@@ -270,8 +270,8 @@ char path[MAXPATHLEN + 1];
*
* NOTE: This won't work if multiple volumes for the same user refer
* to the sahe directory. */
- strcat(path, DBLOCKFILE);
- strcpy(db->lock_file, path);
+ (void)strlcat(path, DBLOCKFILE, sizeof(path));
+ (void)strlcpy(db->lock_file, path, sizeof(db->lock_file));
if ((db->lockfd = open(path, O_RDWR | O_CREAT, 0666 & ~mask)) > -1) {
lock.l_start = 0;
lock.l_len = 1;

View File

@ -1,21 +0,0 @@
$OpenBSD: patch-libatalk_cnid_cnid_private_h,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- libatalk/cnid/cnid_private.h.orig Mon Aug 18 11:47:57 2003
+++ libatalk/cnid/cnid_private.h Mon Aug 18 11:53:07 2003
@@ -49,7 +49,7 @@ typedef struct CNID_private {
#endif /* EXTENDED_DB */
DB_ENV *dbenv;
int lockfd, flags;
- char lock_file[MAXPATHLEN + 1];
+ char lock_file[MAXPATHLEN];
} CNID_private;
/* on-disk data format (in network byte order where appropriate) --
@@ -122,7 +122,7 @@ static __inline__ char *make_cnid_data(c
char *buf = start;
u_int32_t i;
- if (len > MAXPATHLEN)
+ if (len > MAXPATHLEN-1)
return NULL;
i = htonl(st->st_dev);

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-libatalk_compat_getusershell_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- libatalk/compat/getusershell.c.orig Mon Aug 18 11:31:02 2003
+++ libatalk/compat/getusershell.c Mon Aug 18 11:46:12 2003
@@ -121,7 +121,7 @@ initshells()
}
sp = shells;
cp = strings;
- while (fgets(cp, MAXPATHLEN + 1, fp) != NULL) {
+ while (fgets(cp, MAXPATHLEN, fp) != NULL) {
while (*cp != '#' && *cp != '/' && *cp != '\0')
cp++;
if (*cp == '#' || *cp == '\0')

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-libatalk_dsi_dsi_stream_c,v 1.2 2003/08/22 11:18:19 naddy Exp $
--- libatalk/dsi/dsi_stream.c.orig Fri Jan 3 02:32:21 2003
+++ libatalk/dsi/dsi_stream.c Fri Jan 3 02:34:13 2003
@@ -78,7 +78,8 @@ size_t dsi_stream_read(DSI *dsi, void *d
else if (len > 0)
stored += len;
else { /* eof or error */
- LOG(log_error, logtype_default, "dsi_stream_read(%d): %s", len, (len < 0)?strerror(errno):"unexpected EOF");
+ if (len !=0) /* error */
+ LOG(log_error, logtype_default, "dsi_stream_read(%d): %s", len, (len < 0)?strerror(errno):"unexpected EOF");
break;
}
}

View File

@ -1,20 +0,0 @@
netatalk - File and Print Server for AppleTalk networks
netatalk is a server software for AppleTalk networks. Features include:
o Access to the UNIX file system for Macintosh and other systems with
AppleShare client software.
o Spool PostScript print jobs to the lpd(8) spool system via Printer Access
Protocol (PAP).
o Output PostScript print jobs from the lpd(8) spool system via Printer
Access Protocol (PAP).
o Filter PostScript, ASCII, and various other formats to PostScript,
including banner pages and page reversal.
o Route AppleTalk between multiple Ethernet interfaces.
Requires AppleTalk support in the kernel (OpenBSD 2.2 or newer).
Compile a kernel with option NETATALK