From 6b5971ba8ecfd8203cfbe53b74e57b1632652b8e Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Apr 09 2009 11:56:31 +0000 Subject: get back to older version of jiffies64 patch --- diff --git a/authd-1.4.3-jiffies64.patch b/authd-1.4.3-jiffies64.patch index 669efcc..dd96e2e 100644 --- a/authd-1.4.3-jiffies64.patch +++ b/authd-1.4.3-jiffies64.patch @@ -1,115 +1,35 @@ diff -up authd-1.4.3/authd.c.jiffies64 authd-1.4.3/authd.c ---- 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 +--- 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 static const char *const DELIM = ",: \t\r\n\v\f"; --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 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 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 + static unsigned long get_tok_uint(char *s, unsigned base) { + unsigned long ul = ULONG_MAX; - 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 +@@ -643,7 +659,7 @@ 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) -+ /* 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) ++ (void) get_tok_ullong(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) { diff --git a/authd.spec b/authd.spec index c3ce09e..801df0d 100644 --- a/authd.spec +++ b/authd.spec @@ -1,7 +1,7 @@ Summary: A RFC 1413 ident protocol daemon Name: authd Version: 1.4.3 -Release: 25%{?dist} +Release: 26%{?dist} License: GPLv2+ Group: System Environment/Daemons URL: https://fedorahosted.org/authd/ @@ -75,6 +75,9 @@ service xinetd reload %{_sbindir}/in.authd %changelog +* Thu Apr 09 2009 Roman Rakus - 1.4.3-26 +- get back to older version of jiffies64 patch + * Tue Mar 31 2009 Roman Rakus - 1.4.3-25 - Fixed source tag