aboutsummaryrefslogtreecommitdiff
path: root/website/static/security/patches/EN-16:03/yplib.patch
blob: f3e405ec47dd45fdd550dde68044336e81b6c2ef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
--- lib/libc/yp/yplib.c.orig
+++ lib/libc/yp/yplib.c
@@ -655,7 +655,7 @@
 	struct timeval tv;
 	struct ypreq_key yprk;
 	int r;
-
+	int retries = 0;
 	*outval = NULL;
 	*outvallen = 0;
 
@@ -700,6 +700,11 @@
 #endif
 
 again:
+	if (retries > MAX_RETRIES) {
+		YPUNLOCK();
+		return (YPERR_RPC);
+	}
+
 	if (_yp_dobind(indomain, &ysd) != 0) {
 		YPUNLOCK();
 		return (YPERR_DOMAIN);
@@ -716,6 +721,7 @@
 	if (r != RPC_SUCCESS) {
 		clnt_perror(ysd->dom_client, "yp_match: clnt_call");
 		_yp_unbind(ysd);
+		retries++;
 		goto again;
 	}
 
@@ -772,7 +778,7 @@
 	struct dom_binding *ysd;
 	struct timeval tv;
 	int r;
-
+	int retries = 0;
 	/* Sanity check */
 
 	if (indomain == NULL || !strlen(indomain) ||
@@ -784,6 +790,11 @@
 
 	YPLOCK();
 again:
+	if (retries > MAX_RETRIES) {
+		YPUNLOCK();
+		return (YPERR_RPC);
+	}
+
 	if (_yp_dobind(indomain, &ysd) != 0) {
 		YPUNLOCK();
 		return (YPERR_DOMAIN);
@@ -802,6 +813,7 @@
 	if (r != RPC_SUCCESS) {
 		clnt_perror(ysd->dom_client, "yp_first: clnt_call");
 		_yp_unbind(ysd);
+		retries++;
 		goto again;
 	}
 	if (!(r = ypprot_err(yprkv.stat))) {
@@ -844,7 +856,7 @@
 	struct dom_binding *ysd;
 	struct timeval tv;
 	int r;
-
+	int retries = 0;
 	/* Sanity check */
 
 	if (inkey == NULL || !strlen(inkey) || inkeylen <= 0 ||
@@ -857,6 +869,11 @@
 
 	YPLOCK();
 again:
+	if (retries > MAX_RETRIES) {
+		YPUNLOCK();
+		return (YPERR_RPC);
+	}
+
 	if (_yp_dobind(indomain, &ysd) != 0) {
 		YPUNLOCK();
 		return (YPERR_DOMAIN);
@@ -877,6 +894,7 @@
 	if (r != RPC_SUCCESS) {
 		clnt_perror(ysd->dom_client, "yp_next: clnt_call");
 		_yp_unbind(ysd);
+		retries++;
 		goto again;
 	}
 	if (!(r = ypprot_err(yprkv.stat))) {
@@ -920,7 +938,7 @@
 	CLIENT *clnt;
 	u_long status, savstat;
 	int clnt_sock;
-
+	int retries = 0;
 	/* Sanity check */
 
 	if (indomain == NULL || !strlen(indomain) ||
@@ -929,6 +947,10 @@
 
 	YPLOCK();
 again:
+	if (retries > MAX_RETRIES) {
+		YPUNLOCK();
+		return (YPERR_RPC);
+	}
 
 	if (_yp_dobind(indomain, &ysd) != 0) {
 		YPUNLOCK();
@@ -958,9 +980,10 @@
 	if (clnt_call(clnt, YPPROC_ALL,
 		(xdrproc_t)xdr_ypreq_nokey, &yprnk,
 		(xdrproc_t)xdr_ypresp_all_seq, &status, tv) != RPC_SUCCESS) {
-			clnt_perror(ysd->dom_client, "yp_all: clnt_call");
+			clnt_perror(clnt, "yp_all: clnt_call");
 			clnt_destroy(clnt);
 			_yp_unbind(ysd);
+			retries++;
 			goto again;
 	}