Browse code

- fixed the call of acc functions from the uac_redirect module (protoype of acc functions has changed). Fixes 1816765.

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@2951 689a6050-402a-0410-94f2-e92a70836424

Bogdan-Andrei Iancu authored on 20/10/2007 16:28:01
Showing 3 changed files
... ...
@@ -41,10 +41,11 @@
41 41
 #define DEFAULT_Q_VALUE          10
42 42
 
43 43
 static int shmcontact2dset(struct sip_msg *req, struct sip_msg *shrpl,
44
-			long max, str *reason);
44
+		long max, struct acc_param *reason);
45 45
 
46 46
 
47
-int get_redirect( struct sip_msg *msg , int maxt, int maxb, str *reason)
47
+int get_redirect( struct sip_msg *msg , int maxt, int maxb,
48
+												struct acc_param *reason)
48 49
 {
49 50
 	struct cell *t;
50 51
 	str backup_uri;
... ...
@@ -167,7 +168,7 @@ static int sort_contacts(contact_t *ct_list, contact_t **ct_array,
167 167
  *            n - ok and n contacts added
168 168
  */
169 169
 static int shmcontact2dset(struct sip_msg *req, struct sip_msg *sh_rpl,
170
-													long max, str *reason)
170
+											long max, struct acc_param *reason)
171 171
 {
172 172
 	static struct sip_msg  dup_rpl;
173 173
 	static contact_t *scontacts[MAX_CONTACTS_PER_REPLY];
... ...
@@ -33,6 +33,7 @@
33 33
 #include "../../sr_module.h"
34 34
 #include "../../str.h"
35 35
 #include "../tm/tm_load.h"
36
+#include "../acc/acc_logic.h"
36 37
 
37 38
 typedef int (*tm_get_trans_f)( struct sip_msg*, struct cell**);
38 39
 
... ...
@@ -41,7 +42,8 @@ extern cmd_function   rd_acc_fct;
41 41
 
42 42
 extern char *acc_db_table;
43 43
 
44
-int get_redirect( struct sip_msg *msg , int maxt, int maxb, str *reason);
44
+int get_redirect( struct sip_msg *msg , int maxt, int maxb,
45
+		struct acc_param *reason);
45 46
 
46 47
 #endif
47 48
 
... ...
@@ -136,10 +136,10 @@ int get_nr_max(char *s, unsigned char *max)
136 136
 static int get_redirect_fixup(void** param, int param_no)
137 137
 {
138 138
 	unsigned char maxb,maxt;
139
+	struct acc_param *accp;
139 140
 	cmd_function fct;
140 141
 	char *p;
141 142
 	char *s;
142
-	str  *reason;
143 143
 
144 144
 	s = (char*)*param;
145 145
 	if (param_no==1) {
... ...
@@ -178,19 +178,20 @@ static int get_redirect_fixup(void** param, int param_no)
178 178
 		}
179 179
 		rd_acc_fct = fct;
180 180
 		/* set the reason str */
181
-		reason = (str*)pkg_malloc(sizeof(str));
182
-		if (reason==0) {
181
+		accp = (struct acc_param*)pkg_malloc(sizeof(struct acc_param));
182
+		if (accp==0) {
183 183
 			LM_ERR("no more pkg mem\n");
184 184
 			return E_UNSPEC;
185 185
 		}
186
+		memset( accp, 0, sizeof(struct acc_param));
186 187
 		if (s!=0 && *s!=0) {
187
-			reason->s = s;
188
-			reason->len = strlen(s);
188
+			accp->reason.s = s;
189
+			accp->reason.len = strlen(s);
189 190
 		} else {
190
-			reason->s = "n/a";
191
-			reason->len = 3;
191
+			accp->reason.s = "n/a";
192
+			accp->reason.len = 3;
192 193
 		}
193
-		*param=(void*)reason;
194
+		*param=(void*)accp;
194 195
 	}
195 196
 
196 197
 	return 0;
... ...
@@ -342,7 +343,7 @@ static int w_get_redirect2(struct sip_msg* msg, char *max_c, char *reason)
342 342
 	msg_tracer( msg, 0);
343 343
 	/* get the contacts */
344 344
 	max = (unsigned short)(long)max_c;
345
-	n = get_redirect( msg , (max>>8)&0xff, max&0xff, (str*)reason);
345
+	n = get_redirect(msg , (max>>8)&0xff, max&0xff, (struct acc_param*)reason);
346 346
 	reset_filters();
347 347
 	/* reset the tracer */
348 348
 	msg_tracer( msg, 1);
... ...
@@ -350,6 +351,7 @@ static int w_get_redirect2(struct sip_msg* msg, char *max_c, char *reason)
350 350
 	return n;
351 351
 }
352 352
 
353
+
353 354
 static int w_get_redirect1(struct sip_msg* msg, char *max_c, char *foo)
354 355
 {
355 356
 	return w_get_redirect2(msg, max_c, 0);