Roman Rakus a6bce6
--- authd.c.orig	2013-07-25 09:31:23.000000000 +0100
Roman Rakus a6bce6
+++ authd.c	2013-07-17 11:59:53.000000000 +0100
Roman Rakus a6bce6
@@ -381,6 +381,23 @@
Roman Rakus a6bce6
     return ul;
Roman Rakus a6bce6
 }
Roman Rakus a6bce6
 
Roman Rakus a6bce6
+static long get_tok_int(char *s, unsigned base) {
Roman Rakus a6bce6
+
Roman Rakus a6bce6
+    long l = LONG_MAX;
Roman Rakus a6bce6
+
Roman Rakus a6bce6
+    assert(base <= 36);
Roman Rakus a6bce6
+    if ((s = strtok(s, DELIM)) != NULL) {
Roman Rakus a6bce6
+        char *endptr;
Roman Rakus a6bce6
+
Roman Rakus a6bce6
+        l = strtol(s, &endptr, (int) base);
Roman Rakus a6bce6
+        if (l > INT_MAX || is_bad_strto(s, endptr))
Roman Rakus a6bce6
+            errno = EINVAL;
Roman Rakus a6bce6
+    }
Roman Rakus a6bce6
+    else errno = EINVAL;
Roman Rakus a6bce6
+    return l;
Roman Rakus a6bce6
+}
Roman Rakus a6bce6
+
Roman Rakus a6bce6
+
Roman Rakus a6bce6
 static void destroy_opt(void) {
Roman Rakus a6bce6
     free(opt.codeset); free(opt.Encrypt); free(opt.ident); free(opt.lang);
Roman Rakus a6bce6
     free(opt.Noident); free(opt.os); free(opt.passwd); free(opt.mapped);
Roman Rakus a6bce6
@@ -603,7 +620,9 @@
Roman Rakus a6bce6
 static const char *const TEXT_READ_MODE = "r"; // passphrase, /proc plaintext
Roman Rakus a6bce6
 
Roman Rakus a6bce6
 static bool get_info(reply_t *out, request_t in, const char *tcpname) {
Roman Rakus a6bce6
-    unsigned long lport, rport, uid, status; FILE *stream;
Roman Rakus a6bce6
+    //unsigned long lport, rport, uid, status; FILE *stream;
Roman Rakus a6bce6
+    unsigned long lport, rport, status; FILE *stream;
Roman Rakus a6bce6
+    long uid;
Roman Rakus a6bce6
     const unsigned long ESTABLISHED = 0x01;
Roman Rakus a6bce6
     unsigned lineno = 0;
Roman Rakus a6bce6
     char *laddr = NULL, *raddr = NULL;
Roman Rakus a6bce6
@@ -675,7 +694,8 @@
Roman Rakus a6bce6
         (void) get_tok_uint(NULL, 16);            // tr (boolean)
Roman Rakus a6bce6
         (void) get_tok_ullong(NULL, 16);            // tm->when (unit: jiffies)
Roman Rakus a6bce6
         strtok(NULL, DELIM);                      // retrnsmt
Roman Rakus a6bce6
-        uid = get_tok_uint(NULL, 10);             // uid (base 10 uint)
Roman Rakus a6bce6
+        //uid = get_tok_uint(NULL, 10);             // uid (base 10 uint)
Roman Rakus a6bce6
+        uid = get_tok_int(NULL, 10);             // uid (base 10 int)
Roman Rakus a6bce6
         strtok(NULL, DELIM);                      // timeout
Roman Rakus a6bce6
         inode = get_tok_uint(NULL, 10);           // inode (base 10 uint)
Roman Rakus a6bce6
         if (errno == EINVAL) {