summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ftpd/ftpd.c11
-rw-r--r--libexec/rtld-elf/Makefile1
-rw-r--r--libexec/rtld-elf/rtld.c8
-rw-r--r--libexec/tftpd/tftp-file.c33
-rw-r--r--libexec/tftpd/tftpd.860
-rw-r--r--libexec/ulog-helper/Makefile4
-rw-r--r--libexec/ulog-helper/ulog-helper.c24
-rw-r--r--libexec/ypxfr/ypxfr_extern.h2
-rw-r--r--libexec/ypxfr/ypxfr_main.c4
9 files changed, 108 insertions, 39 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 21c218e..5894f3c 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1191,9 +1191,9 @@ end_login(void)
ftpd_logwtmp(wtmpid, NULL, NULL);
pw = NULL;
#ifdef LOGIN_CAP
- setusercontext(NULL, getpwuid(0), 0,
- LOGIN_SETPRIORITY|LOGIN_SETRESOURCES|LOGIN_SETUMASK|
- LOGIN_SETMAC);
+ setusercontext(NULL, getpwuid(0), 0, LOGIN_SETALL & ~(LOGIN_SETLOGIN |
+ LOGIN_SETUSER | LOGIN_SETGROUP | LOGIN_SETPATH |
+ LOGIN_SETENV));
#endif
#ifdef USE_PAM
if (pamh) {
@@ -1465,9 +1465,8 @@ skip:
return;
}
}
- setusercontext(lc, pw, 0,
- LOGIN_SETLOGIN|LOGIN_SETGROUP|LOGIN_SETPRIORITY|
- LOGIN_SETRESOURCES|LOGIN_SETUMASK|LOGIN_SETMAC);
+ setusercontext(lc, pw, 0, LOGIN_SETALL &
+ ~(LOGIN_SETUSER | LOGIN_SETPATH | LOGIN_SETENV));
#else
setlogin(pw->pw_name);
(void) initgroups(pw->pw_name, pw->pw_gid);
diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile
index 45318b9..95bec19 100644
--- a/libexec/rtld-elf/Makefile
+++ b/libexec/rtld-elf/Makefile
@@ -17,6 +17,7 @@ RTLD_ARCH= ${MACHINE_CPUARCH}
.endif
CFLAGS+= -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR}
.if ${MACHINE_ARCH} == "powerpc64"
+CFLAGS+= -mcall-aixdesc
LDFLAGS+= -nostdlib -e _rtld_start
.else
LDFLAGS+= -nostdlib -e .rtld_start
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 5c2db0a..722b274 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -928,8 +928,8 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
obj->textrel = true;
if (dynp->d_un.d_val & DF_BIND_NOW)
obj->bind_now = true;
- if (dynp->d_un.d_val & DF_STATIC_TLS)
- ;
+ /*if (dynp->d_un.d_val & DF_STATIC_TLS)
+ ;*/
break;
#ifdef __mips__
case DT_MIPS_LOCAL_GOTNO:
@@ -958,8 +958,8 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
obj->z_noopen = true;
if ((dynp->d_un.d_val & DF_1_ORIGIN) && trust)
obj->z_origin = true;
- if (dynp->d_un.d_val & DF_1_GLOBAL)
- /* XXX */;
+ /*if (dynp->d_un.d_val & DF_1_GLOBAL)
+ XXX ;*/
if (dynp->d_un.d_val & DF_1_BIND_NOW)
obj->bind_now = true;
if (dynp->d_un.d_val & DF_1_NODELETE)
diff --git a/libexec/tftpd/tftp-file.c b/libexec/tftpd/tftp-file.c
index 1ef8820..6b8fb6e 100644
--- a/libexec/tftpd/tftp-file.c
+++ b/libexec/tftpd/tftp-file.c
@@ -27,6 +27,8 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
@@ -249,9 +251,34 @@ read_close(void)
}
+/* When an error has occurred, it is possible that the two sides
+ * are out of synch. Ie: that what I think is the other side's
+ * response to packet N is really their response to packet N-1.
+ *
+ * So, to try to prevent that, we flush all the input queued up
+ * for us on the network connection on our host.
+ *
+ * We return the number of packets we flushed (mostly for reporting
+ * when trace is active).
+ */
+
int
-synchnet(int peer __unused)
+synchnet(int peer) /* socket to flush */
{
-
- return 0;
+ int i, j = 0;
+ char rbuf[MAXPKTSIZE];
+ struct sockaddr_storage from;
+ socklen_t fromlen;
+
+ while (1) {
+ (void) ioctl(peer, FIONREAD, &i);
+ if (i) {
+ j++;
+ fromlen = sizeof from;
+ (void) recvfrom(peer, rbuf, sizeof (rbuf), 0,
+ (struct sockaddr *)&from, &fromlen);
+ } else {
+ return(j);
+ }
+ }
}
diff --git a/libexec/tftpd/tftpd.8 b/libexec/tftpd/tftpd.8
index 3bac492..96bd24c 100644
--- a/libexec/tftpd/tftpd.8
+++ b/libexec/tftpd/tftpd.8
@@ -32,7 +32,7 @@
.\" @(#)tftpd.8 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd September 14, 2000
+.Dd June 22, 2011
.Dt TFTPD 8
.Os
.Sh NAME
@@ -150,9 +150,27 @@ compatible format string for the creation of the suffix if
.Fl W
is specified.
By default the string "%Y%m%d" is used.
-.It Fl d
+.It Fl d, d Ar [value]
Enables debug output.
-If specified twice, it will log DATA and ACK packets too.
+If
+.Ar value
+is not specified, then the debug level is increased by one
+for each instance of
+.Fl d
+which is specified.
+.Pp
+If
+.Ar value
+is specified, then the debug level is set to
+.Ar value .
+The debug level is a bitmask implemented in
+.Pa src/libexec/tftpd/tftp-utils.h .
+Valid values are 0 (DEBUG_NONE), 1 (DEBUG_PACKETS), 2, (DEBUG_SIMPLE),
+4 (DEBUG_OPTIONS), and 8 (DEBUG_ACCESS). Multiple debug values can be combined
+in the bitmask by logically OR'ing the values. For example, specifying
+.Fl d
+.Ar 15
+will enable all the debug values.
.It Fl l
Log all requests using
.Xr syslog 3
@@ -217,12 +235,34 @@ option.
.Xr services 5 ,
.Xr syslog.conf 5 ,
.Xr inetd 8
+.Pp
+The following RFC's are supported:
.Rs
-.%A K. R. Sollins
+RFC 1350
.%T The TFTP Protocol (Revision 2)
-.%D July 1992
-.%O RFC 1350, STD 33
.Re
+.Rs
+RFC 2347
+.%T TFTP Option Extension
+.Re
+.Rs
+RFC 2348
+.%T TFTP Blocksize Option
+.Re
+.Rs
+RFC 2349
+.%T TFTP Timeout Interval and Transfer Size Options
+.Re
+.Pp
+The non-standard
+.Cm rollover
+and
+.Cm blksize2
+TFTP options are mentioned here:
+.Rs
+.%T Extending TFTP
+.%U http://www.compuphase.com/tftp.htm
+.Re
.Sh HISTORY
The
.Nm
@@ -253,9 +293,15 @@ was introduced in
support for the TFTP Blocksize Option (RFC2348) and the blksize2 option
was introduced in
.Fx 7.4 .
+.Pp
+Edwin Groothuis <edwin@FreeBSD.org> performed a major rewrite of the
+.Nm
+and
+.Xr tftp 1
+code to support RFC2348.
.Sh NOTES
Files larger than 33488896 octets (65535 blocks) cannot be transferred
-without client and server supporting the the TFTP blocksize option (RFC2348),
+without client and server supporting the TFTP blocksize option (RFC2348),
or the non-standard TFTP rollover option.
.Pp
Many tftp clients will not transfer files over 16744448 octets (32767 blocks).
diff --git a/libexec/ulog-helper/Makefile b/libexec/ulog-helper/Makefile
index 3c1770c..c1697c8 100644
--- a/libexec/ulog-helper/Makefile
+++ b/libexec/ulog-helper/Makefile
@@ -5,7 +5,7 @@ BINOWN= root
BINMODE=4555
NO_MAN=
-DPADD= ${LIBULOG} ${LIBMD}
-LDADD= -lulog -lmd
+DPADD= ${LIBULOG}
+LDADD= -lulog
.include <bsd.prog.mk>
diff --git a/libexec/ulog-helper/ulog-helper.c b/libexec/ulog-helper/ulog-helper.c
index eaef778..31b40e9 100644
--- a/libexec/ulog-helper/ulog-helper.c
+++ b/libexec/ulog-helper/ulog-helper.c
@@ -36,11 +36,11 @@ __FBSDID("$FreeBSD$");
/*
* This setuid helper utility writes user login records to disk.
- * Unprivileged processes are not capable of writing records to utmp,
- * wtmp and lastlog, but we do want to allow this for pseudo-terminals.
- * Because a file descriptor to a pseudo-terminal master device can only
- * be obtained by processes using the pseudo-terminal, we expect such a
- * descriptor on stdin.
+ * Unprivileged processes are not capable of writing records to utmpx,
+ * but we do want to allow this for pseudo-terminals. Because a file
+ * descriptor to a pseudo-terminal master device can only be obtained by
+ * processes using the pseudo-terminal, we expect such a descriptor on
+ * stdin.
*
* It uses the real user ID of the calling process to determine the
* username. It does allow users to log arbitrary hostnames.
@@ -49,26 +49,22 @@ __FBSDID("$FreeBSD$");
int
main(int argc, char *argv[])
{
- const char *line;
+ const char *line, *user, *host;
/* Device line name. */
if ((line = ptsname(STDIN_FILENO)) == NULL)
return (EX_USAGE);
if ((argc == 2 || argc == 3) && strcmp(argv[1], "login") == 0) {
- struct passwd *pwd;
- const char *host = NULL;
-
/* Username. */
- pwd = getpwuid(getuid());
- if (pwd == NULL)
+ user = user_from_uid(getuid(), 1);
+ if (user == NULL)
return (EX_OSERR);
/* Hostname. */
- if (argc == 3)
- host = argv[2];
+ host = argc == 3 ? argv[2] : NULL;
- ulog_login(line, pwd->pw_name, host);
+ ulog_login(line, user, host);
return (EX_OK);
} else if (argc == 2 && strcmp(argv[1], "logout") == 0) {
ulog_logout(line);
diff --git a/libexec/ypxfr/ypxfr_extern.h b/libexec/ypxfr/ypxfr_extern.h
index 2712bb9..f843b64 100644
--- a/libexec/ypxfr/ypxfr_extern.h
+++ b/libexec/ypxfr/ypxfr_extern.h
@@ -44,7 +44,7 @@ extern BTREEINFO openinfo_b;
#define _PATH_YP "/var/yp/"
#endif
-extern const char *yp_dir;
+extern char *yp_dir;
extern int debug;
extern enum ypstat yp_errno;
extern void yp_error(const char *, ...);
diff --git a/libexec/ypxfr/ypxfr_main.c b/libexec/ypxfr/ypxfr_main.c
index 636bc3d..f6b478a 100644
--- a/libexec/ypxfr/ypxfr_main.c
+++ b/libexec/ypxfr/ypxfr_main.c
@@ -51,8 +51,8 @@ __FBSDID("$FreeBSD$");
#include <rpcsvc/ypxfrd.h>
#include "ypxfr_extern.h"
-const char *progname = "ypxfr";
-const char *yp_dir = _PATH_YP;
+char *progname = "ypxfr";
+char *yp_dir = _PATH_YP;
int _rpcpmstart = 0;
int ypxfr_use_yplib = 0; /* Assume the worst. */
int ypxfr_clear = 1;
OpenPOWER on IntegriCloud