Browse code

authorized hook cloner updated.

Jan Janak authored on 25/02/2003 19:03:30
Showing 1 changed files
... ...
@@ -179,6 +179,38 @@ static inline struct auth_body* auth_body_cloner(char* new_buf, char *org_buf, s
179 179
 	return new_auth;
180 180
 }
181 181
 
182
+static inline void clone_authorized_hooks(struct sip_msg* new, struct sip_msg* old)
183
+{
184
+	struct hdr_field* ptr, *new_ptr, *hook1, *hook2;
185
+	char stop = 0;
186
+
187
+	get_authorized_cred(old->authorization, &hook1);
188
+	if (!hook1) stop = 1;
189
+	
190
+	get_authorized_cred(old->proxy_auth, &hook2);
191
+	if (!hook2) stop |= 2;
192
+
193
+	ptr = old->headers;
194
+	new_ptr = new->headers;
195
+
196
+	while(ptr) {
197
+		if (ptr == hook1) {
198
+			((struct auth_body*)new->authorization->parsed)->authorized = new_ptr;
199
+			stop |= 1;
200
+		}
201
+		
202
+		if (ptr == hook2) {
203
+			((struct auth_body*)new->proxy_auth->parsed)->authorized = new_ptr;
204
+			stop |= 2;
205
+		}
206
+
207
+		if (stop == 3) break;
208
+
209
+		ptr = ptr->next;
210
+		new_ptr = new_ptr->next;
211
+	}
212
+}
213
+
182 214
 
183 215
 #define AUTH_BODY_SIZE sizeof(struct auth_body)
184 216
 
... ...
@@ -591,6 +623,8 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
591 623
 		rpl_lump_anchor = &((*rpl_lump_anchor)->next);
592 624
 	}
593 625
 
626
+	clone_authorized_hooks(new_msg, org_msg);
627
+	
594 628
 	return new_msg;
595 629
 }
596 630