View | Details | Raw Unified | Return to bug 169645
Collapse All | Expand All

(-)usr.bin/telnet/Makefile (-1 / +5 lines)
Lines 10-16 Link Here
10
SRCS=		commands.c main.c network.c ring.c sys_bsd.c \
10
SRCS=		commands.c main.c network.c ring.c sys_bsd.c \
11
		telnet.c terminal.c utilities.c
11
		telnet.c terminal.c utilities.c
12
12
13
CFLAGS+=	-DKLUDGELINEMODE -DUSE_TERMIO -DENV_HACK -DOPIE \
13
CFLAGS+=	-DKLUDGELINEMODE -DUSE_TERMIO -DENV_HACK \
14
		-I${TELNETDIR} -I${TELNETDIR}/libtelnet/
14
		-I${TELNETDIR} -I${TELNETDIR}/libtelnet/
15
15
16
.if ${MK_INET6_SUPPORT} != "no"
16
.if ${MK_INET6_SUPPORT} != "no"
Lines 47-50 Link Here
47
.endif
47
.endif
48
.endif
48
.endif
49
49
50
.if ${MK_OPIE_SUPPORT} != "no"
51
CFLAGS+=	-DOPIE
52
.endif
53
50
.include <bsd.prog.mk>
54
.include <bsd.prog.mk>
(-)usr.bin/Makefile (-4 / +9 lines)
Lines 143-151 Link Here
143
	nohup \
143
	nohup \
144
	${_nslookup} \
144
	${_nslookup} \
145
	${_nsupdate} \
145
	${_nsupdate} \
146
	opieinfo \
146
	${_opieinfo} \
147
	opiekey \
147
	${_opiekey} \
148
	opiepasswd \
148
	${_opiepasswd} \
149
	pagesize \
149
	pagesize \
150
	passwd \
150
	passwd \
151
	paste \
151
	paste \
Lines 178-184 Link Here
178
	split \
178
	split \
179
	stat \
179
	stat \
180
	su \
180
	su \
181
	systat \
182
	tabs \
181
	tabs \
183
	tail \
182
	tail \
184
	talk \
183
	talk \
Lines 390-393 Link Here
390
_smbutil=	smbutil
389
_smbutil=	smbutil
391
.endif
390
.endif
392
391
392
.if ${MK_OPIE_SUPPORT} != "no"
393
_opieinfo=	opieinfo
394
_opiekey=	opiekey
395
_opiepasswd=	opiepasswd
396
.endif
397
393
.include <bsd.subdir.mk>
398
.include <bsd.subdir.mk>
(-)share/mk/bsd.own.mk (+2 lines)
Lines 357-362 Link Here
357
    OBJC \
357
    OBJC \
358
    OPENSSH \
358
    OPENSSH \
359
    OPENSSL \
359
    OPENSSL \
360
    OPIE \
360
    PAM \
361
    PAM \
361
    PF \
362
    PF \
362
    PKGTOOLS \
363
    PKGTOOLS \
Lines 505-510 Link Here
505
    KERBEROS \
506
    KERBEROS \
506
    KVM \
507
    KVM \
507
    NETGRAPH \
508
    NETGRAPH \
509
    OPIE \
508
    PAM \
510
    PAM \
509
    WIRELESS
511
    WIRELESS
510
.if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT)
512
.if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT)
(-)share/mk/bsd.libnames.mk (-1 / +5 lines)
Lines 101-107 Link Here
101
LIBNGATM?=	${DESTDIR}${LIBDIR}/libngatm.a
101
LIBNGATM?=	${DESTDIR}${LIBDIR}/libngatm.a
102
LIBNVPAIR?=	${DESTDIR}${LIBDIR}/libnvpair.a
102
LIBNVPAIR?=	${DESTDIR}${LIBDIR}/libnvpair.a
103
LIBOBJC?=	${DESTDIR}${LIBDIR}/libobjc.a
103
LIBOBJC?=	${DESTDIR}${LIBDIR}/libobjc.a
104
.if ${MK_OPIE_SUPPORT} != "no"
104
LIBOPIE?=	${DESTDIR}${LIBDIR}/libopie.a
105
LIBOPIE?=	${DESTDIR}${LIBDIR}/libopie.a
106
LIBPAM+=	${LIBOPIE}
107
MINUSLPAM+=	-lopie
108
.endif
105
109
106
# The static PAM library doesn't know its secondary dependencies,
110
# The static PAM library doesn't know its secondary dependencies,
107
# so we have to specify them explicitly.
111
# so we have to specify them explicitly.
Lines 116-122 Link Here
116
LIBPAM+=	${LIBRADIUS} ${LIBTACPLUS} ${LIBCRYPT} \
120
LIBPAM+=	${LIBRADIUS} ${LIBTACPLUS} ${LIBCRYPT} \
117
		${LIBUTIL} ${LIBOPIE} ${LIBMD}
121
		${LIBUTIL} ${LIBOPIE} ${LIBMD}
118
MINUSLPAM+=	-lradius -ltacplus -lcrypt \
122
MINUSLPAM+=	-lradius -ltacplus -lcrypt \
119
		-lutil -lopie -lmd
123
		-lutil -lmd
120
.if ${MK_OPENSSH} != "no"
124
.if ${MK_OPENSSH} != "no"
121
LIBPAM+=	${LIBSSH} ${LIBCRYPTO} ${LIBCRYPT}
125
LIBPAM+=	${LIBSSH} ${LIBCRYPTO} ${LIBCRYPT}
122
MINUSLPAM+=	-lssh -lcrypto -lcrypt
126
MINUSLPAM+=	-lssh -lcrypto -lcrypt
(-)lib/Makefile (-1 / +5 lines)
Lines 82-88 Link Here
82
	${_libmp} \
82
	${_libmp} \
83
	${_libncp} \
83
	${_libncp} \
84
	${_libngatm} \
84
	${_libngatm} \
85
	libopie \
85
	${_libopie} \
86
	libpam \
86
	libpam \
87
	libpcap \
87
	libpcap \
88
	${_libpmc} \
88
	${_libpmc} \
Lines 202-205 Link Here
202
_libusb=	libusb
202
_libusb=	libusb
203
.endif
203
.endif
204
204
205
.if ${MK_OPIE_SUPPORT} != "no"
206
_libopie=   libopie
207
.endif
208
205
.include <bsd.subdir.mk>
209
.include <bsd.subdir.mk>
(-)lib/libpam/modules/modules.inc (+2 lines)
Lines 17-24 Link Here
17
MODULES		+= pam_lastlog
17
MODULES		+= pam_lastlog
18
MODULES		+= pam_login_access
18
MODULES		+= pam_login_access
19
MODULES		+= pam_nologin
19
MODULES		+= pam_nologin
20
.if ${MK_OPIE_SUPPORT} != "no"
20
MODULES		+= pam_opie
21
MODULES		+= pam_opie
21
MODULES		+= pam_opieaccess
22
MODULES		+= pam_opieaccess
23
.endif
22
MODULES		+= pam_passwdqc
24
MODULES		+= pam_passwdqc
23
MODULES		+= pam_permit
25
MODULES		+= pam_permit
24
MODULES		+= pam_radius
26
MODULES		+= pam_radius
(-)etc/Makefile (-2 / +13 lines)
Lines 104-109 Link Here
104
.if ${MK_SENDMAIL} != "no"
104
.if ${MK_SENDMAIL} != "no"
105
MTREE+=	BSD.sendmail.dist
105
MTREE+=	BSD.sendmail.dist
106
.endif
106
.endif
107
.if ${MK_OPIE_SUPPORT} != "no"
108
MTREE+= BSD.opie.dist
109
.endif
107
.if ${MK_BIND} != "no"
110
.if ${MK_BIND} != "no"
108
MTREE+=	BIND.chroot.dist
111
MTREE+=	BIND.chroot.dist
109
.if ${MK_BIND_LIBS} != "no"
112
.if ${MK_BIND_LIBS} != "no"
Lines 156-162 Link Here
156
	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
159
	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
157
		${BIN2} ${DESTDIR}/etc; \
160
		${BIN2} ${DESTDIR}/etc; \
158
	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
161
	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
159
		master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
162
		master.passwd nsmb.conf ${DESTDIR}/etc; \
163
	    
160
.if ${MK_AT} == "no"
164
.if ${MK_AT} == "no"
161
	sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
165
	sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
162
.endif
166
.endif
Lines 203-208 Link Here
203
	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
207
	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
204
	    ${SSL} ${DESTDIR}/etc/ssl
208
	    ${SSL} ${DESTDIR}/etc/ssl
205
.endif
209
.endif
210
.if ${MK_OPIE_SUPPORT} != "no"
211
	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
212
	    opieaccess ${DESTDIR}/etc
213
.endif
206
.if ${MK_KERBEROS} != "no"
214
.if ${MK_KERBEROS} != "no"
207
	cd ${.CURDIR}/root; \
215
	cd ${.CURDIR}/root; \
208
	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
216
	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
Lines 270-275 Link Here
270
.if ${MK_SENDMAIL} != "no"
278
.if ${MK_SENDMAIL} != "no"
271
	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.sendmail.dist -p ${DESTDIR}/
279
	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.sendmail.dist -p ${DESTDIR}/
272
.endif
280
.endif
281
.if ${MK_OPIE_SUPPORT} != "no"
282
	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.opie.dist -p ${DESTDIR}/
283
.endif
273
	cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys
284
	cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys
274
	cd ${DESTDIR}/usr/share/man/en.ISO8859-1; ln -sf ../man* .
285
	cd ${DESTDIR}/usr/share/man/en.ISO8859-1; ln -sf ../man* .
275
	cd ${DESTDIR}/usr/share/man/en.UTF-8; ln -sf ../man* .
286
	cd ${DESTDIR}/usr/share/man/en.UTF-8; ln -sf ../man* .
Lines 301-307 Link Here
301
312
302
etc-examples:
313
etc-examples:
303
	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
314
	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
304
	    ${BIN1} ${BIN2} nsmb.conf opieaccess \
315
	    ${BIN1} ${BIN2} nsmb.conf \
305
	    ${DESTDIR}/usr/share/examples/etc
316
	    ${DESTDIR}/usr/share/examples/etc
306
	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
317
	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
307
	    DESTDIR=${DESTDIR}/usr/share/examples
318
	    DESTDIR=${DESTDIR}/usr/share/examples
(-)etc/mtree/BSD.var.dist (-2 lines)
Lines 77-84 Link Here
77
        ..
77
        ..
78
        mqueue
78
        mqueue
79
        ..
79
        ..
80
        opielocks       mode=0700
81
        ..
82
        output
80
        output
83
            lpd
81
            lpd
84
            ..
82
            ..
(-)etc/mtree/BSD.opie.dist (+15 lines)
Line 0 Link Here
1
# $FreeBSD$
2
#
3
# Please see the file src/etc/mtree/README before making changes to this file.
4
#
5
6
/set type=dir uname=root gname=wheel mode=0755
7
.               nochange
8
    var             nochange
9
        spool           nochange
10
            opielocks   gname=daemon mode=0700
11
            ..
12
        ..
13
    ..
14
..
15
(-)etc/mtree/Makefile (+1 lines)
Lines 10-15 Link Here
10
	BSD.usr.dist \
10
	BSD.usr.dist \
11
	BSD.var.dist \
11
	BSD.var.dist \
12
	BSD.x11-4.dist \
12
	BSD.x11-4.dist \
13
	BSD.opie.dist \
13
	BSD.x11.dist
14
	BSD.x11.dist
14
15
15
.if ${MK_BIND} != "no"
16
.if ${MK_BIND} != "no"
(-)libexec/lukemftpd/Makefile (-7 / +12 lines)
Lines 1-8 Link Here
1
#	@(#)Makefile	8.2 (Berkeley) 4/4/94
1
#	@(#)Makefile	8.2 (Berkeley) 4/4/94
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
.include <bsd.own.mk>
5
6
LUKEMFTPD=	${.CURDIR}/../../contrib/lukemftpd
4
LUKEMFTPD=	${.CURDIR}/../../contrib/lukemftpd
7
.PATH: ${LUKEMFTPD}/src ${LUKEMFTPD}/libnetbsd
5
.PATH: ${LUKEMFTPD}/src ${LUKEMFTPD}/libnetbsd
8
6
Lines 14-20 Link Here
14
12
15
WFORMAT= 0
13
WFORMAT= 0
16
14
17
.if ${MK_INET6_SUPPORT} != "no"
15
.if !defined(NO_INET6)
18
CFLAGS+= -DINET6
16
CFLAGS+= -DINET6
19
.endif
17
.endif
20
18
Lines 33-48 Link Here
33
DPADD+=	${LIBM}
31
DPADD+=	${LIBM}
34
LDADD+=	-lm
32
LDADD+=	-lm
35
33
36
CFLAGS+= -DUSE_OPIE -DLOGIN_CAP
34
CFLAGS+= -DLOGIN_CAP
37
DPADD+=	${LIBOPIE} ${LIBMD}
35
DPADD+=	${LIBMD}
38
LDADD+=	-lopie -lmd
36
LDADD+=	-lmd
39
37
40
.if ${MK_PAM_SUPPORT} != "no"
38
.if !defined(NO_PAM)
41
CFLAGS+= -DUSE_PAM
39
CFLAGS+= -DUSE_PAM
42
DPADD+=	${LIBPAM}
40
DPADD+=	${LIBPAM}
43
LDADD+=	${MINUSLPAM}
41
LDADD+=	${MINUSLPAM}
44
.endif
42
.endif
45
43
44
.if !defined(NO_OPIE)
45
CFLAGS+= -DUSE_OPIE
46
DPADD+= ${LIBOPIE}
47
LDADD+= -lopie
48
.endif
49
46
CLEANFILES+=	ls-unmain.c
50
CLEANFILES+=	ls-unmain.c
47
ls-unmain.c: ls.c
51
ls-unmain.c: ls.c
48
	sed -e 's/^main(/ls_main(/g' -e 's,extern.h,${LSDIR}/extern.h,' \
52
	sed -e 's/^main(/ls_main(/g' -e 's,extern.h,${LSDIR}/extern.h,' \
Lines 58-60 Link Here
58
.include <bsd.prog.mk>
62
.include <bsd.prog.mk>
59
63
60
${OBJS}: ${.CURDIR}/nbsd2fbsd.h
64
${OBJS}: ${.CURDIR}/nbsd2fbsd.h
65
(-)libexec/ftpd/Makefile (-4 / +10 lines)
Lines 17-24 Link Here
17
LDADD=	-lutil -lcrypt
17
LDADD=	-lutil -lcrypt
18
18
19
# XXX Kluge! Conversation mechanism needs to be fixed.
19
# XXX Kluge! Conversation mechanism needs to be fixed.
20
DPADD+=	${LIBOPIE} ${LIBMD}
20
DPADD+=	${LIBMD}
21
LDADD+=	-lopie -lmd
21
LDADD+=	-lmd
22
22
23
LSDIR=	../../bin/ls
23
LSDIR=	../../bin/ls
24
.PATH:	${.CURDIR}/${LSDIR}
24
.PATH:	${.CURDIR}/${LSDIR}
Lines 33-40 Link Here
33
33
34
.if ${MK_PAM_SUPPORT} != "no"
34
.if ${MK_PAM_SUPPORT} != "no"
35
CFLAGS+=-DUSE_PAM
35
CFLAGS+=-DUSE_PAM
36
DPADD+= ${LIBPAM}
36
DPADD+=	${LIBPAM}
37
LDADD+= ${MINUSLPAM}
37
LDADD+=	${MINUSLPAM}
38
.endif
38
.endif
39
39
40
.if ${MK_OPIE_SUPPORT} != "no"
41
CFLAGS+=	-DUSE_OPIE
42
DPADD+=	${LIBOPIE}
43
LDADD+=	-lopie
44
.endif
45
40
.include <bsd.prog.mk>
46
.include <bsd.prog.mk>
(-)libexec/ftpd/ftpd.c (-13 / +63 lines)
Lines 79-85 Link Here
79
#include <netdb.h>
79
#include <netdb.h>
80
#include <pwd.h>
80
#include <pwd.h>
81
#include <grp.h>
81
#include <grp.h>
82
#include <opie.h>
83
#include <signal.h>
82
#include <signal.h>
84
#include <stdint.h>
83
#include <stdint.h>
85
#include <stdio.h>
84
#include <stdio.h>
Lines 97-102 Link Here
97
#include <security/pam_appl.h>
96
#include <security/pam_appl.h>
98
#endif
97
#endif
99
98
99
#ifdef USE_OPIE
100
#include <opie.h>
101
#endif
102
100
#include "pathnames.h"
103
#include "pathnames.h"
101
#include "extern.h"
104
#include "extern.h"
102
105
Lines 105-110 Link Here
105
static char version[] = "Version 6.00LS";
108
static char version[] = "Version 6.00LS";
106
#undef main
109
#undef main
107
110
111
extern	off_t restart_point;
112
extern	char cbuf[];
113
108
union sockunion ctrl_addr;
114
union sockunion ctrl_addr;
109
union sockunion data_source;
115
union sockunion data_source;
110
union sockunion data_dest;
116
union sockunion data_dest;
Lines 181-188 Link Here
181
pam_handle_t	*pamh = NULL;
187
pam_handle_t	*pamh = NULL;
182
#endif
188
#endif
183
189
190
#ifdef USE_OPIE
184
static struct opie	opiedata;
191
static struct opie	opiedata;
185
static char		opieprompt[OPIE_CHALLENGE_MAX+1];
192
static char		opieprompt[OPIE_CHALLENGE_MAX+1];
193
#endif
194
186
static int		pwok;
195
static int		pwok;
187
196
188
char	*pid_file = NULL; /* means default location to pidfile(3) */
197
char	*pid_file = NULL; /* means default location to pidfile(3) */
Lines 245-251 Link Here
245
static void	 maskurg(int);
254
static void	 maskurg(int);
246
static void	 flagxfer(int);
255
static void	 flagxfer(int);
247
static int	 myoob(void);
256
static int	 myoob(void);
248
static int	 checkuser(char *, char *, int, char **);
257
static int	 checkuser(char *, char *, int, char **, int *);
249
static FILE	*dataconn(char *, off_t, char *);
258
static FILE	*dataconn(char *, off_t, char *);
250
static void	 dolog(struct sockaddr *);
259
static void	 dolog(struct sockaddr *);
251
static void	 end_login(void);
260
static void	 end_login(void);
Lines 998-1003 Link Here
998
void
1007
void
999
user(char *name)
1008
user(char *name)
1000
{
1009
{
1010
	int ecode;
1001
	char *cp, *shell;
1011
	char *cp, *shell;
1002
1012
1003
	if (logged_in) {
1013
	if (logged_in) {
Lines 1018-1026 Link Here
1018
	pw = sgetpwnam("ftp");
1028
	pw = sgetpwnam("ftp");
1019
#endif
1029
#endif
1020
	if (strcmp(name, "ftp") == 0 || strcmp(name, "anonymous") == 0) {
1030
	if (strcmp(name, "ftp") == 0 || strcmp(name, "anonymous") == 0) {
1021
		if (checkuser(_PATH_FTPUSERS, "ftp", 0, NULL) ||
1031
		if (checkuser(_PATH_FTPUSERS, "ftp", 0, NULL, &ecode) ||
1022
		    checkuser(_PATH_FTPUSERS, "anonymous", 0, NULL))
1032
		    (ecode != 0 && ecode != ENOENT))
1023
			reply(530, "User %s access denied.", name);
1033
			reply(530, "User %s access denied.", name);
1034
		else if (checkuser(_PATH_FTPUSERS, "anonymous", 0, NULL, &ecode) ||
1035
		    (ecode != 0 && ecode != ENOENT))
1036
			reply(530, "User %s access denied.", name);
1024
		else if (pw != NULL) {
1037
		else if (pw != NULL) {
1025
			guest = 1;
1038
			guest = 1;
1026
			askpasswd = 1;
1039
			askpasswd = 1;
Lines 1047-1053 Link Here
1047
				break;
1060
				break;
1048
		endusershell();
1061
		endusershell();
1049
1062
1050
		if (cp == NULL || checkuser(_PATH_FTPUSERS, name, 1, NULL)) {
1063
		if (cp == NULL || 
1064
		    (checkuser(_PATH_FTPUSERS, name, 1, NULL, &ecode) ||
1065
		    (ecode != 0 && ecode != ENOENT))) {
1051
			reply(530, "User %s access denied.", name);
1066
			reply(530, "User %s access denied.", name);
1052
			if (logging)
1067
			if (logging)
1053
				syslog(LOG_NOTICE,
1068
				syslog(LOG_NOTICE,
Lines 1064-1076 Link Here
1064
#ifdef USE_PAM
1079
#ifdef USE_PAM
1065
	/* XXX Kluge! The conversation mechanism needs to be fixed. */
1080
	/* XXX Kluge! The conversation mechanism needs to be fixed. */
1066
#endif
1081
#endif
1082
1083
#ifdef USE_OPIE
1067
	if (opiechallenge(&opiedata, name, opieprompt) == 0) {
1084
	if (opiechallenge(&opiedata, name, opieprompt) == 0) {
1068
		pwok = (pw != NULL) &&
1085
		pwok = (pw != NULL) &&
1069
		       opieaccessfile(remotehost) &&
1086
		       opieaccessfile(remotehost) &&
1070
		       opiealways(pw->pw_dir);
1087
		       opiealways(pw->pw_dir);
1071
		reply(331, "Response to %s %s for %s.",
1088
		reply(331, "Response to %s %s for %s.",
1072
		      opieprompt, pwok ? "requested" : "required", name);
1089
		      opieprompt, pwok ? "requested" : "required", name);
1073
	} else {
1090
	} 
1091
	else 
1092
#endif
1093
	{
1074
		pwok = 1;
1094
		pwok = 1;
1075
		reply(331, "Password required for %s.", name);
1095
		reply(331, "Password required for %s.", name);
1076
	}
1096
	}
Lines 1089-1101 Link Here
1089
 * of the matching line in "residue" if not NULL.
1109
 * of the matching line in "residue" if not NULL.
1090
 */
1110
 */
1091
static int
1111
static int
1092
checkuser(char *fname, char *name, int pwset, char **residue)
1112
checkuser(char *fname, char *name, int pwset, char **residue, int *ecode)
1093
{
1113
{
1094
	FILE *fd;
1114
	FILE *fd;
1095
	int found = 0;
1115
	int found = 0;
1096
	size_t len;
1116
	size_t len;
1097
	char *line, *mp, *p;
1117
	char *line, *mp, *p;
1098
1118
1119
	if (ecode != NULL)
1120
		*ecode = 0;
1099
	if ((fd = fopen(fname, "r")) != NULL) {
1121
	if ((fd = fopen(fname, "r")) != NULL) {
1100
		while (!found && (line = fgetln(fd, &len)) != NULL) {
1122
		while (!found && (line = fgetln(fd, &len)) != NULL) {
1101
			/* skip comments */
1123
			/* skip comments */
Lines 1164-1170 Link Here
1164
				free(mp);
1186
				free(mp);
1165
		}
1187
		}
1166
		(void) fclose(fd);
1188
		(void) fclose(fd);
1167
	}
1189
	} else if (ecode != NULL)
1190
		*ecode = errno;
1168
	return (found);
1191
	return (found);
1169
}
1192
}
1170
1193
Lines 1361-1367 Link Here
1361
void
1384
void
1362
pass(char *passwd)
1385
pass(char *passwd)
1363
{
1386
{
1364
	int rval;
1387
	int rval, ecode;
1365
	FILE *fd;
1388
	FILE *fd;
1366
#ifdef	LOGIN_CAP
1389
#ifdef	LOGIN_CAP
1367
	login_cap_t *lc = NULL;
1390
	login_cap_t *lc = NULL;
Lines 1385-1397 Link Here
1385
#ifdef USE_PAM
1408
#ifdef USE_PAM
1386
		rval = auth_pam(&pw, passwd);
1409
		rval = auth_pam(&pw, passwd);
1387
		if (rval >= 0) {
1410
		if (rval >= 0) {
1411
#ifdef USE_OPIE
1388
			opieunlock();
1412
			opieunlock();
1413
#endif
1389
			goto skip;
1414
			goto skip;
1390
		}
1415
		}
1391
#endif
1416
#endif
1417
#ifdef USE_OPIE
1392
		if (opieverify(&opiedata, passwd) == 0)
1418
		if (opieverify(&opiedata, passwd) == 0)
1393
			xpasswd = pw->pw_passwd;
1419
			xpasswd = pw->pw_passwd;
1394
		else if (pwok) {
1420
		else 
1421
#endif
1422
		if (pwok) {
1395
			xpasswd = crypt(passwd, pw->pw_passwd);
1423
			xpasswd = crypt(passwd, pw->pw_passwd);
1396
			if (passwd[0] == '\0' && pw->pw_passwd[0] != '\0')
1424
			if (passwd[0] == '\0' && pw->pw_passwd[0] != '\0')
1397
				xpasswd = ":";
1425
				xpasswd = ":";
Lines 1492-1502 Link Here
1492
			stats = 0;
1520
			stats = 0;
1493
1521
1494
	dochroot =
1522
	dochroot =
1495
		checkuser(_PATH_FTPCHROOT, pw->pw_name, 1, &residue)
1523
		checkuser(_PATH_FTPCHROOT, pw->pw_name, 1, &residue, &ecode)
1496
#ifdef	LOGIN_CAP	/* Allow login.conf configuration as well */
1524
#ifdef	LOGIN_CAP	/* Allow login.conf configuration as well */
1497
		|| login_getcapbool(lc, "ftp-chroot", 0)
1525
		|| login_getcapbool(lc, "ftp-chroot", 0)
1498
#endif
1526
#endif
1499
	;
1527
	;
1528
	/*
1529
	 * It is possible that checkuser() failed to open the chroot file.
1530
	 * If this is the case, report that logins are un-available, since we
1531
	 * have no way of checking whether or not the user should be chrooted.
1532
	 * We ignore ENOENT since it is not required that this file be present.
1533
	 */
1534
	if (ecode != 0 && ecode != ENOENT) {
1535
		reply(530, "Login not available right now.");
1536
		return;
1537
	}
1500
	chrootdir = NULL;
1538
	chrootdir = NULL;
1501
	/*
1539
	/*
1502
	 * For a chrooted local user,
1540
	 * For a chrooted local user,
Lines 1543-1549 Link Here
1543
			reply(550, "Can't change root.");
1581
			reply(550, "Can't change root.");
1544
			goto bad;
1582
			goto bad;
1545
		}
1583
		}
1546
		__FreeBSD_libc_enter_restricted_mode();
1547
	} else	/* real user w/o chroot */
1584
	} else	/* real user w/o chroot */
1548
		homedir = pw->pw_dir;
1585
		homedir = pw->pw_dir;
1549
	/*
1586
	/*
Lines 1874-1885 Link Here
1874
#ifdef TCP_NOPUSH
1911
#ifdef TCP_NOPUSH
1875
	/*
1912
	/*
1876
	 * Turn off push flag to keep sender TCP from sending short packets
1913
	 * Turn off push flag to keep sender TCP from sending short packets
1877
	 * at the boundaries of each write().
1914
	 * at the boundaries of each write().  Should probably do a SO_SNDBUF
1915
	 * to set the send buffer size as well, but that may not be desirable
1916
	 * in heavy-load situations.
1878
	 */
1917
	 */
1879
	on = 1;
1918
	on = 1;
1880
	if (setsockopt(s, IPPROTO_TCP, TCP_NOPUSH, &on, sizeof on) < 0)
1919
	if (setsockopt(s, IPPROTO_TCP, TCP_NOPUSH, &on, sizeof on) < 0)
1881
		syslog(LOG_WARNING, "data setsockopt (TCP_NOPUSH): %m");
1920
		syslog(LOG_WARNING, "data setsockopt (TCP_NOPUSH): %m");
1882
#endif
1921
#endif
1922
#ifdef SO_SNDBUF
1923
	on = 65536;
1924
	if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &on, sizeof on) < 0)
1925
		syslog(LOG_WARNING, "data setsockopt (SO_SNDBUF): %m");
1926
#endif
1927
1883
	return (fdopen(s, mode));
1928
	return (fdopen(s, mode));
1884
bad:
1929
bad:
1885
	/* Return the real value of errno (close may change it) */
1930
	/* Return the real value of errno (close may change it) */
Lines 2331-2336 Link Here
2331
	code = lstat(filename, &st) == 0 && S_ISDIR(st.st_mode) ? 212 : 213;
2376
	code = lstat(filename, &st) == 0 && S_ISDIR(st.st_mode) ? 212 : 213;
2332
	(void)snprintf(line, sizeof(line), _PATH_LS " -lgA %s", filename);
2377
	(void)snprintf(line, sizeof(line), _PATH_LS " -lgA %s", filename);
2333
	fin = ftpd_popen(line, "r");
2378
	fin = ftpd_popen(line, "r");
2379
	if (fin == NULL) {
2380
		perror_reply(551, filename);
2381
		return;
2382
	}
2334
	lreply(code, "Status of %s:", filename);
2383
	lreply(code, "Status of %s:", filename);
2335
	atstart = 1;
2384
	atstart = 1;
2336
	while ((c = getc(fin)) != EOF) {
2385
	while ((c = getc(fin)) != EOF) {
Lines 3467-3469 Link Here
3467
	}
3516
	}
3468
	return(socks);
3517
	return(socks);
3469
}
3518
}
3519

Return to bug 169645