rpms/authd/devel authd-1.4.3-jiffies64.patch, 1.2, 1.3 authd.spec, 1.50, 1.51

Roman Rakus (rrakus) fedora-extras-commits at redhat.com
Tue Apr 29 11:45:33 UTC 2008


Author: rrakus

Update of /cvs/extras/rpms/authd/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15127

Modified Files:
	authd-1.4.3-jiffies64.patch authd.spec 
Log Message:
Another corrections of jiffies64 patch

authd-1.4.3-jiffies64.patch:

Index: authd-1.4.3-jiffies64.patch
===================================================================
RCS file: /cvs/extras/rpms/authd/devel/authd-1.4.3-jiffies64.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- authd-1.4.3-jiffies64.patch	26 Mar 2008 09:26:55 -0000	1.2
+++ authd-1.4.3-jiffies64.patch	29 Apr 2008 11:44:53 -0000	1.3
@@ -1,35 +1,115 @@
 diff -up authd-1.4.3/authd.c.jiffies64 authd-1.4.3/authd.c
---- authd-1.4.3/authd.c.jiffies64	2004-11-16 00:25:24.000000000 +0100
-+++ authd-1.4.3/authd.c	2008-03-25 11:22:35.000000000 +0100
-@@ -347,6 +347,22 @@ static void create_opt(int argc, char *a
+--- authd-1.4.3/authd.c.jiffies64	2008-04-29 12:25:05.000000000 +0200
++++ authd-1.4.3/authd.c	2008-04-29 13:33:18.000000000 +0200
+@@ -169,8 +169,13 @@ static bool is_rfc1413_token(const char 
+     return is_in_range((size_t) 1, strlen(s), (size_t) 64);
+ }
+ 
+-static bool is_bad_strto(const char *s, const char *endptr) {
+-    if (errno == ERANGE || errno == EINVAL) return true;
++static bool is_bad_strtoul(unsigned long ul, const char *s, const char *endptr) {
++    if ((ul == ULONG_MAX && errno == ERANGE) || errno == EINVAL) return true;
++    return endptr == s || (*endptr != '\0' && !isspace(*endptr));
++}
++
++static bool is_bad_strtoull(unsigned long long ull, const char *s, const char *endptr) {
++    if ((ull == ULLONG_MAX && errno == ERANGE) || errno == EINVAL) return true;
+     return endptr == s || (*endptr != '\0' && !isspace(*endptr));
+ }
+ 
+@@ -253,7 +258,7 @@ static void create_opt(int argc, char *a
+             case 'l':
+                 if (optarg != NULL) {
+                     lu = strtoul(optarg, &endptr, 0);
+-                    if (lu > UINT_MAX || is_bad_strto(optarg, endptr))
++                    if (lu > UINT_MAX || is_bad_strtoul(lu, optarg, endptr))
+                         handle_error(C_FMT, *argv, c, optarg);
+                     else opt.log_mask = (int) lu;
+                     setlogmask(opt.log_mask);
+@@ -263,7 +268,7 @@ static void create_opt(int argc, char *a
+             case 'm':
+                 if (optarg != NULL) {
+                     opt.multiquery = strtoull(optarg, &endptr, 10);
+-                    if (is_bad_strto(optarg, endptr))
++                    if (is_bad_strtoull(opt.multiquery, optarg, endptr))
+                         handle_error(C_FMT, *argv, c, optarg);
+                 }
+                 else opt.multiquery = ULLONG_MAX;
+@@ -275,7 +280,7 @@ static void create_opt(int argc, char *a
+             case 'o': opt.other = true; break;
+             case 't':
+                 lu = optarg == NULL ? DFL_T_O : strtoul(optarg, &endptr, 10);
+-                if (lu > UINT_MAX || is_bad_strto(optarg, endptr))
++                if (lu > UINT_MAX || is_bad_strtoul(lu, optarg, endptr))
+                     handle_error(C_FMT, *argv, c, optarg);
+                 else if (lu < 30) {
+                     log_notice(_("Timeout's too low; Raising to 30.\n"));
+@@ -294,7 +299,7 @@ static void create_opt(int argc, char *a
+             case FN_LONGOPT:
+                 if (optarg != NULL) {
+                     lu = strtoul(optarg, &endptr, 10);
+-                    if (lu > UINT_MAX || is_bad_strto(optarg, endptr))
++                    if (lu > UINT_MAX || is_bad_strtoul(lu, optarg, endptr))
+                         handle_error(S_FMT, *argv, LONG_OPTS[i].name, optarg);
+                     else opt.fn = (unsigned) lu;
+                 }
+@@ -347,7 +352,7 @@ static void create_opt(int argc, char *a
  
  static const char *const DELIM = ",: \t\r\n\v\f";
  
-+static unsigned long long get_tok_ullong(char *s, unsigned base) {
-+    unsigned long long ull = ULLONG_MAX;
-+
-+    assert(base <= 36);
-+    if ((s = strtok(s, DELIM)) != NULL) {
-+        char *endptr;
-+
-+        ull = strtoull(s, &endptr, (int) base);
-+        if ((errno == ERANGE && ull == ULLONG_MAX) || is_bad_strto(s, endptr))
-+            errno = EINVAL;
-+    }
-+    else errno = EINVAL;
-+    return ull;
+-static unsigned long get_tok_uint(char *s, unsigned base) {
++static unsigned long get_tok_ulong(char *s, unsigned base) {
+     unsigned long ul = ULONG_MAX;
+ 
+     assert(base <= 36);
+@@ -355,13 +360,21 @@ static unsigned long get_tok_uint(char *
+         char *endptr;
+ 
+         ul = strtoul(s, &endptr, (int) base);
+-        if (ul > UINT_MAX || is_bad_strto(s, endptr))
++        if (ul > UINT_MAX || is_bad_strtoul(ul, s, endptr))
+             errno = EINVAL;
+     }
+     else errno = EINVAL;
+     return ul;
+ }
+ 
++static unsigned int get_tok_uint(char *s, unsigned base) {
++    unsigned long ul = get_tok_ulong(s, base);
++    if (ul > UINT_MAX)
++        errno = EINVAL;
++    return ul;
 +}
 +
 +
- static unsigned long get_tok_uint(char *s, unsigned base) {
-     unsigned long ul = ULONG_MAX;
+ static void destroy_opt(void) {
+     free(opt.codeset); free(opt.Encrypt); free(opt.ident); free(opt.lang);
+     free(opt.Noident); free(opt.os); free(opt.passwd); free(opt.mapped);
+@@ -510,7 +523,7 @@ static char *get_created_tok_addr(const 
  
-@@ -643,7 +659,7 @@ static bool get_info(reply_t *out, reque
+                 addr_hex[z] = '\0'; z -= HEX_DIG;
+                 ul = strtoul(addr_hex + z, &endptr, 16);
+-                if (is_bad_strto(addr_hex + z, endptr)) {
++                if (is_bad_strtoul(ul, addr_hex + z, endptr)) {
+                     errno = EINVAL; return NULL;
+                 }
+ 	        if ((!IS_IPV4 || 6 == z) && is_16_bits)
+@@ -654,9 +667,17 @@ static bool get_info(reply_t *out, reque
          (void) get_tok_uint(NULL, 16);            // tx_queue
          (void) get_tok_uint(NULL, 16);            // rx_queue
          (void) get_tok_uint(NULL, 16);            // tr (boolean)
 -        (void) get_tok_uint(NULL, 16);            // tm->when (unit: jiffies)
-+        (void) get_tok_ullong(NULL, 16);            // tm->when (unit: jiffies)
++	/* as of 2.4.18 this is sa long in the kernel thus it is 32b on 32b 
++	   platforms and 64b on 64b platforms. 32b platforms also have a 
++	   jiffies_64 but that is not what is exported so we don't have to use
++	   a long long on 32b platforms.
++	   Ref: net/ipv4/tcp_ipv4.c:get_tcp_sock()	   
++	*/
++        (void) get_tok_ulong(NULL, 16);            // tm->when (unit: jiffies)
          strtok(NULL, DELIM);                      // retrnsmt
          uid = get_tok_uint(NULL, 10);             // uid (base 10 uint)
++
++	// beware using timeout. It is a long and may be 64b.
          strtok(NULL, DELIM);                      // timeout
+         inode = get_tok_uint(NULL, 10);           // inode (base 10 uint)
+         if (errno == EINVAL) {


Index: authd.spec
===================================================================
RCS file: /cvs/extras/rpms/authd/devel/authd.spec,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- authd.spec	26 Mar 2008 09:26:55 -0000	1.50
+++ authd.spec	29 Apr 2008 11:44:53 -0000	1.51
@@ -1,7 +1,7 @@
 Summary: A RFC 1413 ident protocol daemon
 Name: authd
 Version: 1.4.3
-Release: 19%{?dist}
+Release: 20%{?dist}
 License: GPLv2+
 Group: System Environment/Daemons
 URL: https://fedorahosted.org/authd/
@@ -32,7 +32,7 @@
 %patch2 -p1 -b .ipv6map
 %patch3 -p1 -b .locale
 %patch4 -p1
-%patch5 -p1
+%patch5 -p1 -b .jiffies64
 sed -i -e "s|/etc|%{_sysconfdir}|" config.h
 
 %build
@@ -73,6 +73,9 @@
 %{_sbindir}/in.authd
 
 %changelog
+* Tue Apr 29 2008 Roman Rakus <rrakus at redhat.cz> - 1.4.3-20
+- another corrections of jiffies64 patch
+
 * Wed Mar 26 2008 Roman Rakus <rrakus at redhat.cz> - 1.4.3-19
 - corrected jiffies64 patch
 




More information about the fedora-extras-commits mailing list