summaryrefslogtreecommitdiff
path: root/contrib/lukemftpd/src/conf.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/lukemftpd/src/conf.c')
-rw-r--r--contrib/lukemftpd/src/conf.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/contrib/lukemftpd/src/conf.c b/contrib/lukemftpd/src/conf.c
index 0c142fcc9374..35953074d8f1 100644
--- a/contrib/lukemftpd/src/conf.c
+++ b/contrib/lukemftpd/src/conf.c
@@ -1,7 +1,7 @@
-/* $NetBSD: conf.c,v 1.52 2004-08-09 12:56:47 lukem Exp $ */
+/* $NetBSD: conf.c,v 1.57 2006/02/01 14:20:12 christos Exp $ */
/*-
- * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997-2005 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: conf.c,v 1.52 2004-08-09 12:56:47 lukem Exp $");
+__RCSID("$NetBSD: conf.c,v 1.57 2006/02/01 14:20:12 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -77,7 +77,7 @@ static int filetypematch(char *, int);
#define DEFAULT_MAXFILESIZE -1 /* unlimited file size */
#define DEFAULT_MAXTIMEOUT 7200 /* 2 hours */
#define DEFAULT_TIMEOUT 900 /* 15 minutes */
-#define DEFAULT_UMASK 027 /* 15 minutes */
+#define DEFAULT_UMASK 027 /* rw-r----- */
/*
* Initialise curclass to an `empty' state
@@ -109,7 +109,7 @@ init_curclass(void)
curclass.maxrateget = 0;
curclass.maxrateput = 0;
curclass.maxtimeout = DEFAULT_MAXTIMEOUT;
- REASSIGN(curclass.motd, xstrdup(_PATH_FTPLOGINMESG));
+ REASSIGN(curclass.motd, ftpd_strdup(_NAME_FTPLOGINMESG));
REASSIGN(curclass.notify, NULL);
curclass.portmin = 0;
curclass.portmax = 0;
@@ -126,6 +126,7 @@ init_curclass(void)
CURCLASS_FLAGS_SET(checkportcmd);
CURCLASS_FLAGS_CLR(denyquick);
+ CURCLASS_FLAGS_CLR(hidesymlinks);
CURCLASS_FLAGS_SET(modify);
CURCLASS_FLAGS_SET(passive);
CURCLASS_FLAGS_CLR(private);
@@ -152,14 +153,14 @@ parse_conf(const char *findclass)
struct ftpconv *conv, *cnext;
init_curclass();
- REASSIGN(curclass.classname, xstrdup(findclass));
+ REASSIGN(curclass.classname, ftpd_strdup(findclass));
/* set more guest defaults */
if (strcasecmp(findclass, "guest") == 0) {
CURCLASS_FLAGS_CLR(modify);
curclass.umask = 0707;
}
- infile = conffilename(_PATH_FTPDCONF);
+ infile = conffilename(_NAME_FTPDCONF);
if ((f = fopen(infile, "r")) == NULL)
return;
@@ -205,7 +206,7 @@ parse_conf(const char *findclass)
if (none || EMPTYSTR(arg)) \
arg = NULL; \
else \
- arg = xstrdup(arg); \
+ arg = ftpd_strdup(arg); \
REASSIGN(curclass.Field, arg); \
} while (0)
@@ -310,16 +311,16 @@ parse_conf(const char *findclass)
convcmd = p;
if (convcmd)
convcmd += strspn(convcmd, " \t");
- suffix = xstrdup(arg);
+ suffix = ftpd_strdup(arg);
if (none || EMPTYSTR(types) ||
EMPTYSTR(disable) || EMPTYSTR(convcmd)) {
types = NULL;
disable = NULL;
convcmd = NULL;
} else {
- types = xstrdup(types);
- disable = xstrdup(disable);
- convcmd = xstrdup(convcmd);
+ types = ftpd_strdup(types);
+ disable = ftpd_strdup(disable);
+ convcmd = ftpd_strdup(convcmd);
}
for (conv = curclass.conversions; conv != NULL;
conv = conv->next) {
@@ -354,6 +355,9 @@ parse_conf(const char *findclass)
} else if (strcasecmp(word, "display") == 0) {
CONF_STRING(display);
+ } else if (strcasecmp(word, "hidesymlinks") == 0) {
+ CONF_FLAG(hidesymlinks);
+
} else if (strcasecmp(word, "homedir") == 0) {
CONF_STRING(homedir);
@@ -362,7 +366,7 @@ parse_conf(const char *findclass)
REASSIGN(curclass.limitfile, NULL);
CONF_LL(limit, arg, -1, LLTMAX);
REASSIGN(curclass.limitfile,
- EMPTYSTR(p) ? NULL : xstrdup(p));
+ EMPTYSTR(p) ? NULL : ftpd_strdup(p));
} else if (strcasecmp(word, "maxfilesize") == 0) {
curclass.maxfilesize = DEFAULT_MAXFILESIZE;
@@ -385,6 +389,10 @@ parse_conf(const char *findclass)
curclass.writesize = 0;
CONF_LL(writesize, arg, 0, LLTMAX);
+ } else if (strcasecmp(word, "recvbufsize") == 0) {
+ curclass.recvbufsize = 0;
+ CONF_LL(recvbufsize, arg, 0, LLTMAX);
+
} else if (strcasecmp(word, "sendbufsize") == 0) {
curclass.sendbufsize = 0;
CONF_LL(sendbufsize, arg, 0, LLTMAX);
@@ -464,7 +472,7 @@ parse_conf(const char *findclass)
} else if (strcasecmp(word, "template") == 0) {
if (none)
continue;
- REASSIGN(template, EMPTYSTR(arg) ? NULL : xstrdup(arg));
+ REASSIGN(template, EMPTYSTR(arg) ? NULL : ftpd_strdup(arg));
} else if (strcasecmp(word, "umask") == 0) {
u_long fumask;
@@ -547,7 +555,7 @@ show_chdir_messages(int code)
if (sl_find(slist, curwd) != NULL)
return;
- cp = xstrdup(curwd);
+ cp = ftpd_strdup(curwd);
if (sl_add(slist, cp) == -1)
syslog(LOG_WARNING, "can't add `%s' to stringlist", cp);
@@ -846,13 +854,13 @@ do_conversion(const char *fname)
/* Split up command into an argv */
if ((sl = sl_init()) == NULL)
goto cleanup_do_conv;
- cmd = xstrdup(cp->command);
+ cmd = ftpd_strdup(cp->command);
p = cmd;
while (p) {
NEXTWORD(p, lp);
if (strcmp(lp, "%s") == 0)
lp = base;
- if (sl_add(sl, xstrdup(lp)) == -1)
+ if (sl_add(sl, ftpd_strdup(lp)) == -1)
goto cleanup_do_conv;
}