summaryrefslogtreecommitdiff
path: root/debian/patches/read_timeout.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/read_timeout.patch')
-rw-r--r--debian/patches/read_timeout.patch170
1 files changed, 170 insertions, 0 deletions
diff --git a/debian/patches/read_timeout.patch b/debian/patches/read_timeout.patch
new file mode 100644
index 0000000..4962e3e
--- /dev/null
+++ b/debian/patches/read_timeout.patch
@@ -0,0 +1,170 @@
+--- a/libtac/include/libtac.h
++++ b/libtac/include/libtac.h
+@@ -131,6 +131,7 @@
+ extern int tac_timeout;
+
+ void tac_set_dscp(uint8_t val);
++void tac_enable_readtimeout(int enable);
+ int tac_connect(struct addrinfo **, char **, int);
+ int tac_connect_single(struct addrinfo *, const char *, struct addrinfo *, int);
+ char *tac_ntop(const struct sockaddr *);
+@@ -138,6 +139,7 @@
+ int tac_authen_send(int, const char *, char *, char *,
+ char *);
+ int tac_authen_read(int);
++int tac_authen_read_timeout(int, int);
+ int tac_cont_send(int, char *);
+ HDR *_tac_req_header(u_char, int);
+ void _tac_crypt(u_char *, HDR *, int);
+@@ -148,6 +150,7 @@
+ int tac_acct_send(int, int, const char *, char *, char *,
+ struct tac_attrib *);
+ int tac_acct_read(int, struct areply *);
++int tac_acct_read_timeout(int, struct areply *, int);
+ void *xcalloc(size_t, size_t);
+ void *xrealloc(void *, size_t);
+ char *xstrcpy(char *, const char *, size_t);
+@@ -155,6 +158,7 @@
+ int tac_author_send(int, const char *, char *, char *,
+ struct tac_attrib *);
+ int tac_author_read(int, struct areply *);
++int tac_author_read_timeout(int, struct areply *, int);
+ int tac_add_attrib_pair(struct tac_attrib **, char *, char,
+ char *);
+ int tac_add_attrib_truncate(struct tac_attrib **attr, char *name, char *value);
+--- a/libtac/lib/acct_r.c
++++ b/libtac/lib/acct_r.c
+@@ -32,7 +32,7 @@
+ * LIBTAC_STATUS_PROTOCOL_ERR
+ * >= 0 : server response, see TAC_PLUS_AUTHEN_STATUS_...
+ */
+-int tac_acct_read(int fd, struct areply *re) {
++int tac_acct_read_timeout(int fd, struct areply *re, int timeout) {
+ HDR th;
+ struct acct_reply *tb = NULL;
+ int len_from_header, r, len_from_body;
+@@ -42,9 +42,9 @@
+ re->msg = NULL;
+
+ if (tac_readtimeout_enable &&
+- tac_read_wait(fd,tac_timeout*1000, TAC_PLUS_HDR_SIZE,&timeleft) < 0 ) {
++ tac_read_wait(fd,timeout*1000, TAC_PLUS_HDR_SIZE,&timeleft) < 0 ) {
+ TACSYSLOG((LOG_ERR,\
+- "%s: reply timeout after %d secs", __FUNCTION__, tac_timeout))
++ "%s: reply timeout after %d secs", __FUNCTION__, timeout))
+ re->msg = xstrdup(acct_syserr_msg);
+ re->status = LIBTAC_STATUS_READ_TIMEOUT;
+ free(tb);
+@@ -80,7 +80,7 @@
+ if (tac_readtimeout_enable &&
+ tac_read_wait(fd,timeleft,len_from_header,NULL) < 0 ) {
+ TACSYSLOG((LOG_ERR,\
+- "%s: reply timeout after %d secs", __FUNCTION__, tac_timeout))
++ "%s: reply timeout after %d secs", __FUNCTION__, timeout))
+ re->msg = xstrdup(acct_syserr_msg);
+ re->status = LIBTAC_STATUS_READ_TIMEOUT;
+ free(tb);
+@@ -156,3 +156,7 @@
+ free(tb);
+ return re->status;
+ }
++
++int tac_acct_read(int fd, struct areply *re) {
++ return tac_acct_read_timeout(fd, re, tac_timeout);
++}
+--- a/libtac/lib/authen_r.c
++++ b/libtac/lib/authen_r.c
+@@ -34,7 +34,7 @@
+ * LIBTAC_STATUS_PROTOCOL_ERR
+ * >= 0 : server response, see TAC_PLUS_AUTHEN_STATUS_...
+ */
+-int tac_authen_read(int fd) {
++int tac_authen_read_timeout(int fd, int timeout) {
+ HDR th;
+ struct authen_reply *tb = NULL;
+ int len_from_header, r, len_from_body;
+@@ -44,9 +44,9 @@
+
+ /* read the reply header */
+ if (tac_readtimeout_enable &&
+- tac_read_wait(fd,tac_timeout*1000,TAC_PLUS_HDR_SIZE,&timeleft) < 0 ) {
++ tac_read_wait(fd,timeout*1000,TAC_PLUS_HDR_SIZE,&timeleft) < 0 ) {
+ TACSYSLOG((LOG_ERR,\
+- "%s: reply timeout after %d secs", __FUNCTION__, tac_timeout))
++ "%s: reply timeout after %d secs", __FUNCTION__, timeout))
+ status=LIBTAC_STATUS_READ_TIMEOUT;
+ free(tb);
+ return status;
+@@ -77,7 +77,7 @@
+ if (tac_readtimeout_enable &&
+ tac_read_wait(fd,timeleft,len_from_header,NULL) < 0 ) {
+ TACSYSLOG((LOG_ERR,\
+- "%s: reply timeout after %d secs", __FUNCTION__, tac_timeout))
++ "%s: reply timeout after %d secs", __FUNCTION__, timeout))
+ status=LIBTAC_STATUS_READ_TIMEOUT;
+ }
+ r = read(fd, tb, len_from_header);
+@@ -136,3 +136,7 @@
+ free(tb);
+ return status;
+ } /* tac_authen_read */
++
++int tac_authen_read(int fd) {
++ return tac_authen_read_timeout(fd, tac_timeout);
++}
+--- a/libtac/lib/author_r.c
++++ b/libtac/lib/author_r.c
+@@ -38,7 +38,8 @@
+ * LIBTAC_STATUS_PROTOCOL_ERR
+ * >= 0 : server response, see TAC_PLUS_AUTHOR_STATUS_...
+ */
+-int tac_author_read(int fd, struct areply *re) {
++
++int tac_author_read_timeout(int fd, struct areply *re, int timeout) {
+ HDR th;
+ struct author_reply *tb = NULL;
+ int len_from_header, r, len_from_body;
+@@ -49,10 +50,10 @@
+
+ bzero(re, sizeof(struct areply));
+ if (tac_readtimeout_enable &&
+- tac_read_wait(fd,tac_timeout*1000,TAC_PLUS_HDR_SIZE,&timeleft) < 0 ) {
++ tac_read_wait(fd,timeout*1000,TAC_PLUS_HDR_SIZE,&timeleft) < 0 ) {
+
+ TACSYSLOG((LOG_ERR,\
+- "%s: reply timeout after %d secs", __FUNCTION__, tac_timeout))
++ "%s: reply timeout after %d secs", __FUNCTION__, timeout))
+ re->msg = xstrdup(author_syserr_msg);
+ re->status = LIBTAC_STATUS_READ_TIMEOUT;
+ free(tb);
+@@ -88,7 +89,7 @@
+ tac_read_wait(fd,timeleft,len_from_header,NULL) < 0 ) {
+
+ TACSYSLOG((LOG_ERR,\
+- "%s: reply timeout after %d secs", __FUNCTION__, tac_timeout))
++ "%s: reply timeout after %d secs", __FUNCTION__, timeout))
+ re->msg = xstrdup(author_syserr_msg);
+ re->status = LIBTAC_STATUS_READ_TIMEOUT;
+ free(tb);
+@@ -240,3 +241,7 @@
+ free(tb);
+ return re->status;
+ }
++
++int tac_author_read(int fd, struct areply *re) {
++ return tac_author_read_timeout(fd, re, tac_timeout);
++}
+--- a/libtac/lib/connect.c
++++ b/libtac/lib/connect.c
+@@ -41,6 +41,11 @@
+ tac_dscp = val;
+ }
+
++
++void tac_enable_readtimeout(int enable) {
++ tac_readtimeout_enable = !!enable;
++}
++
+ /* Returns file descriptor of open connection
+ to the first available server from list passed
+ in server table.