]> andersk Git - openssh.git/blobdiff - misc.c
- (djm) Convert mandoc manpages to man automatically. Patch from Mark D.
[openssh.git] / misc.c
diff --git a/misc.c b/misc.c
index 24f7df597db2b18fb503fc6878784f5685e8b781..feeacb8593b0be7ac416f5b6b579e8e5ee7ff6c8 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/*     $OpenBSD: misc.c,v 1.4 2001/02/28 17:52:54 deraadt Exp $        */
+/*     $OpenBSD: misc.c,v 1.5 2001/04/12 20:09:37 stevesk Exp $        */
 
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: misc.c,v 1.4 2001/02/28 17:52:54 deraadt Exp $");
+RCSID("$OpenBSD: misc.c,v 1.5 2001/04/12 20:09:37 stevesk Exp $");
 
 #include "misc.h"
 #include "log.h"
@@ -108,12 +108,29 @@ pwcopy(struct passwd *pw)
        copy->pw_gecos = xstrdup(pw->pw_gecos);
        copy->pw_uid = pw->pw_uid;
        copy->pw_gid = pw->pw_gid;
+#ifdef HAVE_PW_CLASS_IN_PASSWD
        copy->pw_class = xstrdup(pw->pw_class);
+#endif
        copy->pw_dir = xstrdup(pw->pw_dir);
        copy->pw_shell = xstrdup(pw->pw_shell);
        return copy;
 }
 
+int a2port(const char *s)
+{
+       long port;
+       char *endp;
+
+       errno = 0;
+       port = strtol(s, &endp, 0);
+       if (s == endp || *endp != '\0' ||
+           (errno == ERANGE && (port == LONG_MIN || port == LONG_MAX)) ||
+           port <= 0 || port > 65535)
+               return 0;
+
+       return port;
+}
+
 mysig_t
 mysignal(int sig, mysig_t act)
 {
This page took 0.040265 seconds and 4 git commands to generate.