aboutsummaryrefslogtreecommitdiff
path: root/libexec/tftpd
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2012-11-04 02:52:03 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2012-11-04 02:52:03 +0000
commit23090366f729c56cab62de74c7a51792357e98a9 (patch)
treec511c885796e28ec571b5267e8f11f3b103d35e9 /libexec/tftpd
parent7750ad47a9a7dbc83f87158464170c8640723293 (diff)
parent22ff74b2f44234d31540b1f7fd6c91489c37cad3 (diff)
downloadsrc-23090366f729c56cab62de74c7a51792357e98a9.tar.gz
src-23090366f729c56cab62de74c7a51792357e98a9.zip
Sync from head
Notes
Notes: svn path=/projects/bmake/; revision=242545
Diffstat (limited to 'libexec/tftpd')
-rw-r--r--libexec/tftpd/tftp-io.c4
-rw-r--r--libexec/tftpd/tftp-utils.c2
-rw-r--r--libexec/tftpd/tftpd.c9
3 files changed, 9 insertions, 6 deletions
diff --git a/libexec/tftpd/tftp-io.c b/libexec/tftpd/tftp-io.c
index 3ce4f6ef44e7..d5d7fc6401fc 100644
--- a/libexec/tftpd/tftp-io.c
+++ b/libexec/tftpd/tftp-io.c
@@ -53,7 +53,7 @@ struct sockaddr_storage me_sock;
static int send_packet(int peer, uint16_t block, char *pkt, int size);
-struct errmsg {
+static struct errmsg {
int e_code;
const char *e_msg;
} errmsgs[] = {
@@ -375,7 +375,7 @@ send_data(int peer, uint16_t block, char *data, int size)
/*
* Receive a packet
*/
-jmp_buf timeoutbuf;
+static jmp_buf timeoutbuf;
static void
timeout(int sig __unused)
diff --git a/libexec/tftpd/tftp-utils.c b/libexec/tftpd/tftp-utils.c
index 5613dd1a4925..c55f120a3a4d 100644
--- a/libexec/tftpd/tftp-utils.c
+++ b/libexec/tftpd/tftp-utils.c
@@ -121,7 +121,7 @@ get_field(int peer, char *buffer, ssize_t size)
/*
* Logging functions
*/
-int _tftp_logtostdout = 1;
+static int _tftp_logtostdout = 1;
void
tftp_openlog(const char *ident, int logopt, int facility)
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c
index 16702b70cb1f..a0010b3c5032 100644
--- a/libexec/tftpd/tftpd.c
+++ b/libexec/tftpd/tftpd.c
@@ -107,9 +107,9 @@ static void tftp_xmitfile(int peer, const char *mode);
static int validate_access(int peer, char **, int);
static char peername[NI_MAXHOST];
-FILE *file;
+static FILE *file;
-struct formats {
+static struct formats {
const char *f_mode;
int f_convert;
} formats[] = {
@@ -371,7 +371,10 @@ main(int argc, char *argv[])
}
chdir("/");
setgroups(1, &nobody->pw_gid);
- setuid(nobody->pw_uid);
+ if (setuid(nobody->pw_uid) != 0) {
+ tftp_log(LOG_ERR, "setuid failed");
+ exit(1);
+ }
}
len = sizeof(me_sock);