Commit Diff


commit - eeb616b754913da958b9781aee9ed88db64e7162
commit + 1963be61deb20cacab2552113c66b38fbee7a080
blob - 63098f02298c146e943e4011ce9ae7a50aa48d24
blob + de09563aef39f346f9cf2c078c8dff429dc7bc4a
--- gitwrapper/Makefile
+++ gitwrapper/Makefile
@@ -9,7 +9,7 @@ BINDIR ?=	${PREFIX}/bin
 
 PROG=		gitwrapper
 
-SRCS=		gitwrapper.c parse.y log.c dial.c path.c error.c auth.c \
+SRCS=		gitwrapper.c parse.y log.c dial.c path.c error.c \
 		reference_parse.c hash.c object_parse.c imsg.c \
 		inflate.c pollfd.c
 
blob - dc12f7d7d4e12f45b25c2ea041355a326ba36d91
blob + b463648c859a1713d622a349df2197f561d994bd
--- gotd/auth.c
+++ gotd/auth.c
@@ -70,25 +70,7 @@ auth_sighdlr(int sig, short event, void *arg)
 		break;
 	default:
 		fatalx("unexpected signal");
-	}
-}
-
-int
-gotd_auth_parseuid(const char *s, uid_t *uid)
-{
-	struct passwd *pw;
-	const char *errstr;
-
-	if ((pw = getpwnam(s)) != NULL) {
-		*uid = pw->pw_uid;
-		if (*uid == UID_MAX)
-			return -1;
-		return 0;
 	}
-	*uid = strtonum(s, 0, UID_MAX - 1, &errstr);
-	if (errstr)
-		return -1;
-	return 0;
 }
 
 static int
@@ -96,7 +78,7 @@ uidcheck(const char *s, uid_t desired)
 {
 	uid_t uid;
 
-	if (gotd_auth_parseuid(s, &uid) != 0)
+	if (gotd_parseuid(s, &uid) != 0)
 		return -1;
 	if (uid != desired)
 		return -1;
blob - 87cd12560d438c7e4b48d2f7a762ff678b51d92e
blob + 0fcd934ebdefa26902bdcb8c2548b82a37a8c8a9
--- gotd/auth.h
+++ gotd/auth.h
@@ -14,6 +14,5 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-int gotd_auth_parseuid(const char *, uid_t *);
 void auth_main(const char *title, struct gotd_repolist *repos,
     const char *repo_path);
blob - da5659310b289bac96cef1db5c87299064a62cc5
blob + b08623dd82c94711edc63cc23126b9a581a45c31
--- gotd/gotd.h
+++ gotd/gotd.h
@@ -454,6 +454,7 @@ struct gotd_repo *gotd_find_repo_by_name(const char *,
 struct gotd_repo *gotd_find_repo_by_path(const char *, struct gotd *);
 struct gotd_uid_connection_limit *gotd_find_uid_connection_limit(
     struct gotd_uid_connection_limit *limits, size_t nlimits, uid_t uid);
+int gotd_parseuid(const char *s, uid_t *uid);
 
 /* imsg.c */
 const struct got_error *gotd_imsg_flush(struct imsgbuf *);
blob - a18d6c539c362ef359781888ef0c1a1995b2183f
blob + 8ebf4b83dbc2a957e8463aa6ad76e0f721af95dd
--- gotd/parse.y
+++ gotd/parse.y
@@ -33,6 +33,7 @@
 #include <event.h>
 #include <imsg.h>
 #include <limits.h>
+#include <pwd.h>
 #include <sha1.h>
 #include <sha2.h>
 #include <stdarg.h>
@@ -834,7 +835,7 @@ conf_limit_user_connections(const char *user, int maxi
 		return -1;
 	}
 
-	if (gotd_auth_parseuid(user, &uid) == -1) {
+	if (gotd_parseuid(user, &uid) == -1) {
 		yyerror("%s: no such user", user);
 		return -1;
 	}
@@ -1145,3 +1146,21 @@ gotd_find_uid_connection_limit(struct gotd_uid_connect
 
 	return NULL;
 }
+
+int
+gotd_parseuid(const char *s, uid_t *uid)
+{
+	struct passwd *pw;
+	const char *errstr;
+
+	if ((pw = getpwnam(s)) != NULL) {
+		*uid = pw->pw_uid;
+		if (*uid == UID_MAX)
+			return -1;
+		return 0;
+	}
+	*uid = strtonum(s, 0, UID_MAX - 1, &errstr);
+	if (errstr)
+		return -1;
+	return 0;
+}