rpms/asterisk/devel 0011-Merged-revisions-123952-via-svnmerge-from.patch, NONE, 1.1 asterisk.spec, 1.28, 1.29

Jeffrey C. Ollie (jcollie) fedora-extras-commits at redhat.com
Fri Jul 25 15:58:52 UTC 2008


Author: jcollie

Update of /cvs/pkgs/rpms/asterisk/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2326

Modified Files:
	asterisk.spec 
Added Files:
	0011-Merged-revisions-123952-via-svnmerge-from.patch 
Log Message:
* Fri Jul 25 2008 Jeffrey C. Ollie <jeff at ocjtech.us> - 1.6.0-0.18.beta9
- Add patch for LDAP extracted from upstream SVN (#442011)


0011-Merged-revisions-123952-via-svnmerge-from.patch:

--- NEW FILE 0011-Merged-revisions-123952-via-svnmerge-from.patch ---
>From 5931413c9269ef3fca3444a2c10865860f907758 Mon Sep 17 00:00:00 2001
From: tilghman <tilghman at 614ede4d-c843-0410-af14-a771ab80d22e>
Date: Thu, 19 Jun 2008 17:23:22 +0000
Subject: [PATCH] Merged revisions 123952 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/trunk

........
r123952 | tilghman | 2008-06-19 12:22:27 -0500 (Thu, 19 Jun 2008) | 6 lines

Don't change pointers that need to be later passed back for deallocation.
(closes issue #12572)
 Reported by: flyn
 Patches:
       20080613__bug12572.diff.txt uploaded by Corydon76 (license 14)

........


git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@123958 614ede4d-c843-0410-af14-a771ab80d22e
---
 res/res_config_ldap.c |   85 +++++++++++++++++++++++++-----------------------
 1 files changed, 44 insertions(+), 41 deletions(-)

diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index 7ce37c6..01050ca 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -282,33 +282,36 @@ static struct ast_variable *realtime_ldap_entry_to_var(struct ldap_table_config
 
 		values = ldap_get_values_len(ldapConn, ldap_entry, ldap_attribute_name); /* these are freed at the end */
 		if (values) {
-			struct berval **v = values;
+			struct berval **v;
+			char *valptr;
 
-			while (*v) {
+			for (v = values; *v; v++) {
 				value = *v;
-				ast_debug(2, "LINE(%d) attribute_name: %s LDAP value: %s\n", __LINE__, attribute_name, value->bv_val);
+				valptr = value->bv_val;
+				ast_debug(2, "LINE(%d) attribute_name: %s LDAP value: %s\n", __LINE__, attribute_name, valptr);
 				if (is_realmed_password_attribute) {
-					if (!strncasecmp(value->bv_val, "{md5}", 5))
-						value->bv_val += 5;
-					else
-						value->bv_val = NULL;
-					ast_debug(2, "md5: %s\n", value->bv_val);
+					if (!strncasecmp(valptr, "{md5}", 5)) {
+						valptr += 5;
+					} else {
+						valptr = NULL;
+					}
+					ast_debug(2, "md5: %s\n", valptr);
 				}
-				if (value->bv_val) {
+				if (valptr) {
 					/* ok, so looping through all delimited values except the last one (not, last character is not delimited...) */
 					if (is_delimited) {
 						i = 0;
 						pos = 0;
-						while (!ast_strlen_zero(value->bv_val + i)) {
-							if (value->bv_val[i] == ';'){
-								value->bv_val[i] = '\0';
+						while (!ast_strlen_zero(valptr + i)) {
+							if (valptr[i] == ';'){
+								valptr[i] = '\0';
 								if (prev) {
-									prev->next = ast_variable_new(attribute_name, &value->bv_val[pos], table_config->table_name);
+									prev->next = ast_variable_new(attribute_name, &valptr[pos], table_config->table_name);
 									if (prev->next) {
 										prev = prev->next;
 									}
 								} else {
-									prev = var = ast_variable_new(attribute_name, &value->bv_val[pos], table_config->table_name);
+									prev = var = ast_variable_new(attribute_name, &valptr[pos], table_config->table_name);
 								}
 								pos = i + 1;
 							}
@@ -317,15 +320,14 @@ static struct ast_variable *realtime_ldap_entry_to_var(struct ldap_table_config
 					}
 					/* for the last delimited value or if the value is not delimited: */
 					if (prev) {
-						prev->next = ast_variable_new(attribute_name, &value->bv_val[pos], table_config->table_name);
+						prev->next = ast_variable_new(attribute_name, &valptr[pos], table_config->table_name);
 						if (prev->next) {
 							prev = prev->next;
 						}
 					} else {
-						prev = var = ast_variable_new(attribute_name, &value->bv_val[pos], table_config->table_name);
+						prev = var = ast_variable_new(attribute_name, &valptr[pos], table_config->table_name);
 					}
 				}
-				v++;
 			}
 			ldap_value_free_len(values);
 		}
@@ -400,23 +402,26 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
 
 				values = ldap_get_values_len(ldapConn, ldap_entry, ldap_attribute_name);
 				if (values) {
-					struct berval **v = values;
+					struct berval **v;
+					char *valptr;
 
-					while (*v) {
+					for (v = values; *v; v++) {
 						value = *v;
+						valptr = value->bv_val;
 						if (is_realmed_password_attribute) {
-							if (strncasecmp(value->bv_val, "{md5}", 5) == 0)
-								value->bv_val += 5;
-							else
-								value->bv_val = NULL;
-							ast_debug(2, "md5: %s\n", value->bv_val);
+							if (strncasecmp(valptr, "{md5}", 5) == 0) {
+								valptr += 5;
+							} else {
+								valptr = NULL;
+							}
+							ast_debug(2, "md5: %s\n", valptr);
 						}
-						if (value->bv_val) {
+						if (valptr) {
 							if (delim_value == NULL 
 								&& !is_realmed_password_attribute 
 								&& (static_table_config != table_config || strcmp(attribute_name, "variable_value") == 0)) {
 
-								delim_value = ast_strdup(value->bv_val);
+								delim_value = ast_strdup(valptr);
 
 								if ((delim_tot_count = semicolon_count_str(delim_value)) > 0) {
 									ast_debug(4, "LINE(%d) is delimited %d times: %s\n", __LINE__, delim_tot_count, delim_value);
@@ -426,11 +431,10 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
 
 							if (is_delimited != 0 
 								&& !is_realmed_password_attribute 
-								&& (static_table_config != table_config || strcmp(attribute_name, "variable_value") == 0) ){
+								&& (static_table_config != table_config || strcmp(attribute_name, "variable_value") == 0) ) {
 								/* for non-Static RealTime, first */
 
-								i = pos;
-								while (!ast_strlen_zero(value->bv_val + i)) {
+								for (i = pos; !ast_strlen_zero(valptr + i); i++) {
 									ast_debug(4, "LINE(%d) DELIM pos: %d i: %d\n", __LINE__, pos, i);
 									if (delim_value[i] == ';') {
 										delim_value[i] = '\0';
@@ -451,9 +455,8 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
 											break;
 										}
 									}
-									i++;
 								}
-								if (ast_strlen_zero(value->bv_val + i)) {
+								if (ast_strlen_zero(valptr + i)) {
 									ast_debug(4, "LINE(%d) DELIM pos: %d i: %d delim_count: %d\n", __LINE__, pos, i, delim_count);
 									/* Last delimited value */
 									ast_debug(4, "LINE(%d) DELIM - attribute_name: %s value: %s pos: %d\n", __LINE__, attribute_name, &delim_value[pos], pos);
@@ -468,9 +471,9 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
 									/* Remembering to free memory */
 									is_delimited = 0;
 									pos = 0;
-									free(delim_value);
-									delim_value = NULL;
 								}
+								free(delim_value);
+								delim_value = NULL;
 								
 								ast_debug(4, "LINE(%d) DELIM pos: %d i: %d\n", __LINE__, pos, i);
 							} else {
@@ -479,20 +482,19 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
 									free(delim_value);
 									delim_value = NULL;
 								}
-								ast_debug(2, "LINE(%d) attribute_name: %s value: %s\n", __LINE__, attribute_name, value->bv_val);
+								ast_debug(2, "LINE(%d) attribute_name: %s value: %s\n", __LINE__, attribute_name, valptr);
 
 								if (prev) {
-									prev->next = ast_variable_new(attribute_name, value->bv_val, table_config->table_name);
+									prev->next = ast_variable_new(attribute_name, valptr, table_config->table_name);
 									if (prev->next) {
 										prev = prev->next;
 									}
 								} else {
-									prev = var = ast_variable_new(attribute_name, value->bv_val, table_config->table_name);
+									prev = var = ast_variable_new(attribute_name, valptr, table_config->table_name);
 								}
 							}
 						}
-						v++;
-					} /*!< while(*v) */
+					} /*!< for (v = values; *v; v++) */
 					ldap_value_free_len(values);
 				}/*!< if (values) */
 				ldap_attribute_name = ldap_next_attribute(ldapConn, ldap_entry, ber);
@@ -1459,10 +1461,11 @@ int parse_config(void)
 					static_table_config = table_config;
 			}
 			for (; var; var = var->next) {
-				if (!strcasecmp(var->name, "additionalFilter"))
-					table_config->additional_filter = strdup(var->value);
-				else
+				if (!strcasecmp(var->name, "additionalFilter")) {
+					table_config->additional_filter = ast_strdup(var->value);
+				} else {
 					ldap_table_config_add_attribute(table_config, var->name, var->value);
+				}
 			}
 		}
 	}
-- 
1.5.5.2



Index: asterisk.spec
===================================================================
RCS file: /cvs/pkgs/rpms/asterisk/devel/asterisk.spec,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- asterisk.spec	2 Jul 2008 16:12:30 -0000	1.28
+++ asterisk.spec	25 Jul 2008 15:58:22 -0000	1.29
@@ -4,7 +4,7 @@
 Summary: The Open Source PBX
 Name: asterisk
 Version: 1.6.0
-Release: 0.17.beta%{beta}%{?dist}
+Release: 0.18.beta%{beta}%{?dist}
 License: GPLv2
 Group: Applications/Internet
 URL: http://www.asterisk.org/
@@ -44,6 +44,7 @@
 Patch8:  0008-Build-using-external-libedit.patch
 Patch9:  0009-Update-cdr_tds-to-latest.patch
 Patch10: 0010-Update-autoconf.patch
+Patch11: 0011-Merged-revisions-123952-via-svnmerge-from.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
 
@@ -413,6 +414,7 @@
 %patch8 -p1
 %patch9 -p1
 %patch10 -p1
+%patch11 -p1
 
 cp %{SOURCE2} menuselect.makedeps
 cp %{SOURCE3} menuselect.makeopts
@@ -1023,6 +1025,9 @@
 %{_libdir}/asterisk/modules/codec_zap.so
 
 %changelog
+* Fri Jul 25 2008 Jeffrey C. Ollie <jeff at ocjtech.us> - 1.6.0-0.18.beta9
+- Add patch for LDAP extracted from upstream SVN (#442011)
+
 * Thu Jul  2 2008 Jeffrey C. Ollie <jeff at ocjtech.us> - 1.6.0-0.17.beta9
 - Add patch that unbreaks cdr_tds with FreeTDS 0.82.
 - Properly obsolete conference subpackage.




More information about the fedora-extras-commits mailing list