From d73cbd31a295ac757e59f129f162d9cd69440224 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Mon, 21 Jul 2008 14:41:33 +0000 Subject: - first pass to unify/cleanup uid handling (-236b) This needs further love, alot of love.. Tito? --- networking/httpd.c | 4 +--- networking/libiproute/libnetlink.c | 2 +- networking/tcpudp.c | 7 +++---- networking/tftp.c | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) (limited to 'networking') diff --git a/networking/httpd.c b/networking/httpd.c index f7e044d27..8c4242e44 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -2351,9 +2351,7 @@ int httpd_main(int argc UNUSED_PARAM, char **argv) #endif #if ENABLE_FEATURE_HTTPD_SETUID if (opt & OPT_SETUID) { - if (!get_uidgid(&ugid, s_ugid, 1)) - bb_error_msg_and_die("unknown user[:group] " - "name '%s'", s_ugid); + xget_uidgid(&ugid, s_ugid); } #endif diff --git a/networking/libiproute/libnetlink.c b/networking/libiproute/libnetlink.c index 6b599d91c..01454fbf5 100644 --- a/networking/libiproute/libnetlink.c +++ b/networking/libiproute/libnetlink.c @@ -37,7 +37,7 @@ int FAST_FUNC xrtnl_open(struct rtnl_handle *rth/*, unsigned subscriptions*/) xbind(rth->fd, (struct sockaddr*)&rth->local, sizeof(rth->local)); addr_len = sizeof(rth->local); if (getsockname(rth->fd, (struct sockaddr*)&rth->local, &addr_len) < 0) - bb_perror_msg_and_die("cannot getsockname"); + bb_perror_msg_and_die("getsockname"); if (addr_len != sizeof(rth->local)) bb_error_msg_and_die("wrong address length %d", addr_len); if (rth->local.nl_family != AF_NETLINK) diff --git a/networking/tcpudp.c b/networking/tcpudp.c index 29408c5be..d6731198c 100644 --- a/networking/tcpudp.c +++ b/networking/tcpudp.c @@ -216,8 +216,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv) if (max_per_host > cmax) max_per_host = cmax; if (option_mask32 & OPT_u) { - if (!get_uidgid(&ugid, user, 1)) - bb_error_msg_and_die("unknown user/group: %s", user); + xget_uidgid(&ugid, user); } #ifdef SSLSVD if (option_mask32 & OPT_U) ssluser = optarg; @@ -245,9 +244,9 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv) if (option_mask32 & OPT_u) if (!uidgid_get(&sslugid, ssluser, 1)) { if (errno) { - bb_perror_msg_and_die("fatal: cannot get user/group: %s", ssluser); + bb_perror_msg_and_die("can't get user/group: %s", ssluser); } - bb_error_msg_and_die("unknown user/group '%s'", ssluser); + bb_error_msg_and_die("unknown user/group %s", ssluser); } if (!cert) cert = "./cert.pem"; if (!key) key = cert; diff --git a/networking/tftp.c b/networking/tftp.c index d09a6eba5..07d672dcb 100644 --- a/networking/tftp.c +++ b/networking/tftp.c @@ -225,7 +225,7 @@ static int tftp_protocol( if (user_opt) { struct passwd *pw = getpwnam(user_opt); if (!pw) - bb_error_msg_and_die("unknown user '%s'", user_opt); + bb_error_msg_and_die("unknown user %s", user_opt); change_identity(pw); /* initgroups, setgid, setuid */ } } -- cgit v1.2.3