Deleted Added
full compact
ftpd.c (202209) ftpd.c (202604)
1/*
2 * Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 32 unchanged lines hidden (view full) ---

41
42#ifndef lint
43#if 0
44static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94";
45#endif
46#endif /* not lint */
47
48#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 32 unchanged lines hidden (view full) ---

41
42#ifndef lint
43#if 0
44static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94";
45#endif
46#endif /* not lint */
47
48#include <sys/cdefs.h>
49__FBSDID("$FreeBSD: head/libexec/ftpd/ftpd.c 202209 2010-01-13 18:28:41Z ed $");
49__FBSDID("$FreeBSD: head/libexec/ftpd/ftpd.c 202604 2010-01-18 23:28:25Z ed $");
50
51/*
52 * FTP server.
53 */
54#include <sys/param.h>
55#include <sys/ioctl.h>
56#include <sys/mman.h>
57#include <sys/socket.h>

--- 1115 unchanged lines hidden (view full) ---

1173static void
1174end_login(void)
1175{
1176#ifdef USE_PAM
1177 int e;
1178#endif
1179
1180 (void) seteuid(0);
50
51/*
52 * FTP server.
53 */
54#include <sys/param.h>
55#include <sys/ioctl.h>
56#include <sys/mman.h>
57#include <sys/socket.h>

--- 1115 unchanged lines hidden (view full) ---

1173static void
1174end_login(void)
1175{
1176#ifdef USE_PAM
1177 int e;
1178#endif
1179
1180 (void) seteuid(0);
1181 if (logged_in && dowtmp && !dochroot)
1182 ftpd_logwtmp(wtmpid, "", NULL);
1181 if (logged_in && dowtmp)
1182 ftpd_logwtmp(wtmpid, NULL, NULL);
1183 pw = NULL;
1184#ifdef LOGIN_CAP
1185 setusercontext(NULL, getpwuid(0), 0,
1186 LOGIN_SETPRIORITY|LOGIN_SETRESOURCES|LOGIN_SETUMASK|
1187 LOGIN_SETMAC);
1188#endif
1189#ifdef USE_PAM
1190 if (pamh) {

--- 286 unchanged lines hidden (view full) ---

1477 dochroot =
1478 checkuser(_PATH_FTPCHROOT, pw->pw_name, 1, &residue)
1479#ifdef LOGIN_CAP /* Allow login.conf configuration as well */
1480 || login_getcapbool(lc, "ftp-chroot", 0)
1481#endif
1482 ;
1483 chrootdir = NULL;
1484
1183 pw = NULL;
1184#ifdef LOGIN_CAP
1185 setusercontext(NULL, getpwuid(0), 0,
1186 LOGIN_SETPRIORITY|LOGIN_SETRESOURCES|LOGIN_SETUMASK|
1187 LOGIN_SETMAC);
1188#endif
1189#ifdef USE_PAM
1190 if (pamh) {

--- 286 unchanged lines hidden (view full) ---

1477 dochroot =
1478 checkuser(_PATH_FTPCHROOT, pw->pw_name, 1, &residue)
1479#ifdef LOGIN_CAP /* Allow login.conf configuration as well */
1480 || login_getcapbool(lc, "ftp-chroot", 0)
1481#endif
1482 ;
1483 chrootdir = NULL;
1484
1485 if (dowtmp && !dochroot)
1485 /* Disable wtmp logging when chrooting. */
1486 if (dochroot || guest)
1487 dowtmp = 0;
1488 if (dowtmp)
1486 ftpd_logwtmp(wtmpid, pw->pw_name,
1487 (struct sockaddr *)&his_addr);
1488 logged_in = 1;
1489
1490 if (guest && stats && statfd < 0)
1491#ifdef VIRTUAL_HOSTING
1492 statfd = open(thishost->statfile, O_WRONLY|O_APPEND);
1493#else

--- 1231 unchanged lines hidden (view full) ---

2725/*
2726 * Record logout in wtmp file
2727 * and exit with supplied status.
2728 */
2729void
2730dologout(int status)
2731{
2732
1489 ftpd_logwtmp(wtmpid, pw->pw_name,
1490 (struct sockaddr *)&his_addr);
1491 logged_in = 1;
1492
1493 if (guest && stats && statfd < 0)
1494#ifdef VIRTUAL_HOSTING
1495 statfd = open(thishost->statfile, O_WRONLY|O_APPEND);
1496#else

--- 1231 unchanged lines hidden (view full) ---

2728/*
2729 * Record logout in wtmp file
2730 * and exit with supplied status.
2731 */
2732void
2733dologout(int status)
2734{
2735
2733 if (logged_in && dowtmp && !dochroot) {
2736 if (logged_in && dowtmp) {
2734 (void) seteuid(0);
2737 (void) seteuid(0);
2735 ftpd_logwtmp(wtmpid, "", NULL);
2738 ftpd_logwtmp(wtmpid, NULL, NULL);
2736 }
2737 /* beware of flushing buffers after a SIGPIPE */
2738 _exit(status);
2739}
2740
2741static void
2742sigurg(int signo)
2743{

--- 723 unchanged lines hidden ---
2739 }
2740 /* beware of flushing buffers after a SIGPIPE */
2741 _exit(status);
2742}
2743
2744static void
2745sigurg(int signo)
2746{

--- 723 unchanged lines hidden ---