[asterisk-commits] tilghman: branch tilghman/str_substitution r178204 - in /team/tilghman/str_su...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 23 20:49:38 CST 2009


Author: tilghman
Date: Mon Feb 23 20:49:37 2009
New Revision: 178204

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=178204
Log:
More conversions, and make ast_func_read able to use the newer API, if the old API is not available.

Modified:
    team/tilghman/str_substitution/apps/app_exec.c
    team/tilghman/str_substitution/apps/app_macro.c
    team/tilghman/str_substitution/apps/app_minivm.c
    team/tilghman/str_substitution/main/pbx.c

Modified: team/tilghman/str_substitution/apps/app_exec.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/apps/app_exec.c?view=diff&rev=178204&r1=178203&r2=178204
==============================================================================
--- team/tilghman/str_substitution/apps/app_exec.c (original)
+++ team/tilghman/str_substitution/apps/app_exec.c Mon Feb 23 20:49:37 2009
@@ -132,56 +132,61 @@
 static int exec_exec(struct ast_channel *chan, void *data)
 {
 	int res = 0;
-	char *s, *appname, *endargs, args[MAXRESULT];
+	char *s, *appname, *endargs;
 	struct ast_app *app;
+	struct ast_str *args = NULL;
 
 	if (ast_strlen_zero(data))
 		return 0;
 
 	s = ast_strdupa(data);
-	args[0] = 0;
 	appname = strsep(&s, "(");
 	if (s) {
 		endargs = strrchr(s, ')');
 		if (endargs)
 			*endargs = '\0';
-		pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+		if ((args = ast_str_create(16))) {
+			ast_str_substitute_variables(&args, 0, chan, s);
+		}
 	}
 	if (appname) {
 		app = pbx_findapp(appname);
 		if (app) {
-			res = pbx_exec(chan, app, args);
+			res = pbx_exec(chan, app, args ? ast_str_buffer(args) : NULL);
 		} else {
 			ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
 			res = -1;
 		}
 	}
 
+	ast_free(args);
 	return res;
 }
 
 static int tryexec_exec(struct ast_channel *chan, void *data)
 {
 	int res = 0;
-	char *s, *appname, *endargs, args[MAXRESULT];
+	char *s, *appname, *endargs;
 	struct ast_app *app;
+	struct ast_str *args = NULL;
 
 	if (ast_strlen_zero(data))
 		return 0;
 
 	s = ast_strdupa(data);
-	args[0] = 0;
 	appname = strsep(&s, "(");
 	if (s) {
 		endargs = strrchr(s, ')');
 		if (endargs)
 			*endargs = '\0';
-		pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+		if ((args = ast_str_create(16))) {
+			ast_str_substitute_variables(&args, 0, chan, s);
+		}
 	}
 	if (appname) {
 		app = pbx_findapp(appname);
 		if (app) {
-			res = pbx_exec(chan, app, args);
+			res = pbx_exec(chan, app, args ? ast_str_buffer(args) : NULL);
 			pbx_builtin_setvar_helper(chan, "TRYSTATUS", res ? "FAILED" : "SUCCESS");
 		} else {
 			ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);

Modified: team/tilghman/str_substitution/apps/app_macro.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/apps/app_macro.c?view=diff&rev=178204&r1=178203&r2=178204
==============================================================================
--- team/tilghman/str_substitution/apps/app_macro.c (original)
+++ team/tilghman/str_substitution/apps/app_macro.c Mon Feb 23 20:49:37 2009
@@ -235,12 +235,17 @@
 	int offset, depth = 0, maxdepth = 7;
 	int setmacrocontext=0;
 	int autoloopflag, inhangup = 0;
+	struct ast_str *tmp_subst = NULL;
   
 	char *save_macro_exten;
 	char *save_macro_context;
 	char *save_macro_priority;
 	char *save_macro_offset;
 	struct ast_datastore *macro_store = ast_channel_datastore_find(chan, &macro_ds_info, NULL);
+
+	if (!tmp_subst) {
+		return -1;
+	}
  
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "Macro() requires arguments. See \"core show application macro\" for help.\n");
@@ -285,7 +290,6 @@
 		return 0;
 	}
 	snprintf(depthc, sizeof(depthc), "%d", depth + 1);
-	pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
 
 	tmp = ast_strdupa(data);
 	rest = tmp;
@@ -315,7 +319,11 @@
 		}
 		ast_autoservice_stop(chan);
 	}
-	
+
+	if (!(tmp_subst = ast_str_create(16))) {
+		return -1;
+	}
+
 	/* Save old info */
 	oldpriority = chan->priority;
 	ast_copy_string(oldexten, chan->exten, sizeof(oldexten));
@@ -340,6 +348,8 @@
   
 	save_macro_offset = ast_strdup(pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"));
 	pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", NULL);
+
+	pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
 
 	/* Setup environment for new run */
 	chan->exten[0] = 's';
@@ -419,8 +429,9 @@
 			gosub_level++;
 			ast_debug(1, "Incrementing gosub_level\n");
 		} else if (!strcasecmp(runningapp, "GOSUBIF")) {
-			char tmp2[1024], *cond, *app_arg, *app2 = tmp2;
-			pbx_substitute_variables_helper(chan, runningdata, tmp2, sizeof(tmp2) - 1);
+			char *cond, *app_arg, *app2;
+			ast_str_substitute_variables(&tmp_subst, 0, chan, runningdata);
+			app2 = ast_str_buffer(tmp_subst);
 			cond = strsep(&app2, "?");
 			app_arg = strsep(&app2, ":");
 			if (pbx_checkcondition(cond)) {
@@ -442,19 +453,24 @@
 			ast_debug(1, "Decrementing gosub_level\n");
 		} else if (!strncasecmp(runningapp, "EXEC", 4)) {
 			/* Must evaluate args to find actual app */
-			char tmp2[1024], *tmp3 = NULL;
-			pbx_substitute_variables_helper(chan, runningdata, tmp2, sizeof(tmp2) - 1);
+			char *tmp2, *tmp3 = NULL;
+			ast_str_substitute_variables(&tmp_subst, 0, chan, runningdata);
+			tmp2 = ast_str_buffer(tmp_subst);
 			if (!strcasecmp(runningapp, "EXECIF")) {
 				tmp3 = strchr(tmp2, '|');
-				if (tmp3)
+				if (tmp3) {
 					*tmp3++ = '\0';
-				if (!pbx_checkcondition(tmp2))
+				}
+				if (!pbx_checkcondition(tmp2)) {
 					tmp3 = NULL;
-			} else
+				}
+			} else {
 				tmp3 = tmp2;
-
-			if (tmp3)
+			}
+
+			if (tmp3) {
 				ast_debug(1, "Last app: %s\n", tmp3);
+			}
 
 			if (tmp3 && !strncasecmp(tmp3, "GOSUB", 5)) {
 				gosub_level++;
@@ -551,6 +567,7 @@
 		}
 	}
 	ast_channel_unlock(chan);
+	ast_free(tmp_subst);
 
 	return res;
 }

Modified: team/tilghman/str_substitution/apps/app_minivm.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/apps/app_minivm.c?view=diff&rev=178204&r1=178203&r2=178204
==============================================================================
--- team/tilghman/str_substitution/apps/app_minivm.c (original)
+++ team/tilghman/str_substitution/apps/app_minivm.c Mon Feb 23 20:49:37 2009
@@ -588,7 +588,6 @@
 
 static struct ast_flags globalflags = {0};	/*!< Global voicemail flags */
 static int global_saydurationminfo;
-static char global_charset[32];			/*!< Global charset in messages */
 
 static double global_volgain;	/*!< Volume gain for voicmemail via e-mail */
 
@@ -907,25 +906,6 @@
 	vmu->volgain = global_volgain;
 }
 
-/*! \brief Fix quote of mail headers for non-ascii characters */
-static char *mailheader_quote(const char *from, char *to, size_t len)
-{
-	char *ptr = to;
-	*ptr++ = '"';
-	for (; ptr < to + len - 1; from++) {
-		if (*from == '"')
-			*ptr++ = '\\';
-		else if (*from == '\0')
-			break;
-		*ptr++ = *from;
-	}
-	if (ptr < to + len - 1)
-		*ptr++ = '"';
-	*ptr = '\0';
-	return to;
-}
-
-
 /*! \brief Allocate new vm user and set default values */
 static struct minivm_account *mvm_user_alloc(void)
 {
@@ -1021,6 +1001,95 @@
 
 	ast_variables_destroy(var);
 	return retval;
+}
+
+/*!\brief Check if the string would need encoding within the MIME standard, to
+ * avoid confusing certain mail software that expects messages to be 7-bit
+ * clean.
+ */
+static int check_mime(const char *str)
+{
+	for (; *str; str++) {
+		if (*str > 126 || *str < 32 || strchr("()<>@,:;/\"[]?.=", *str)) {
+			return 1;
+		}
+	}
+	return 0;
+}
+
+/*!\brief Encode a string according to the MIME rules for encoding strings
+ * that are not 7-bit clean or contain control characters.
+ *
+ * Additionally, if the encoded string would exceed the MIME limit of 76
+ * characters per line, then the encoding will be broken up into multiple
+ * sections, separated by a space character, in order to facilitate
+ * breaking up the associated header across multiple lines.
+ *
+ * \param start A string to be encoded
+ * \param end An expandable buffer for holding the result
+ * \param preamble The length of the first line already used for this string,
+ * to ensure that each line maintains a maximum length of 76 chars.
+ * \param postamble the length of any additional characters appended to the
+ * line, used to ensure proper field wrapping.
+ * \retval The encoded string.
+ */
+static char *ast_str_encode_mime(struct ast_str **end, int maxlen, const char *charset, const char *start, size_t preamble, size_t postamble)
+{
+	struct ast_str *tmp = ast_str_alloca(80);
+	int first_section = 1;
+	*end = '\0';
+
+	ast_str_reset(*end);
+	ast_str_set(&tmp, -1, "=?%s?Q?", charset);
+	for (; *start; start++) {
+		int need_encoding = 0;
+		if (*start < 33 || *start > 126 || strchr("()<>@,:;/\"[]?.=_", *start)) {
+			need_encoding = 1;
+		}
+		if ((first_section && need_encoding && preamble + ast_str_strlen(tmp) > 70) ||
+			(first_section && !need_encoding && preamble + ast_str_strlen(tmp) > 72) ||
+			(!first_section && need_encoding && ast_str_strlen(tmp) > 70) ||
+			(!first_section && !need_encoding && ast_str_strlen(tmp) > 72)) {
+			/* Start new line */
+			ast_str_append(end, maxlen, "%s%s?=", first_section ? "" : " ", ast_str_buffer(tmp));
+			ast_str_set(&tmp, -1, "=?%s?Q?", charset);
+			first_section = 0;
+		}
+		if (need_encoding && *start == ' ') {
+			ast_str_append(&tmp, -1, "_");
+		} else if (need_encoding) {
+			ast_str_append(&tmp, -1, "=%hhX", *start);
+		} else {
+			ast_str_append(&tmp, -1, "%c", *start);
+		}
+	}
+	ast_str_append(end, maxlen, "%s%s?=%s", first_section ? "" : " ", ast_str_buffer(tmp), ast_str_strlen(tmp) + postamble > 74 ? " " : "");
+	return ast_str_buffer(*end);
+}
+
+/*!
+ * \brief Wraps a character sequence in double quotes, escaping occurences of quotes within the string.
+ * \param from The string to work with.
+ * \param to The string to write the modified quoted string. This buffer should be sufficiently larger than the from string, so as to allow it to be expanded by the surrounding quotes and escaping of internal quotes.
+ * 
+ * \return The destination string with quotes wrapped on it (the to field).
+ */
+static char *ast_str_quote(struct ast_str **buf, int maxlen, const char *from)
+{
+	const char *ptr;
+
+	/* We're only ever passing 0 to maxlen, so short output isn't possible */
+	ast_str_set(buf, maxlen, "\"");
+	for (ptr = from; *ptr; ptr++) {
+		if (*ptr == '"' || *ptr == '\\') {
+			ast_str_append(buf, maxlen, "\\%c", *ptr);
+		} else {
+			ast_str_append(buf, maxlen, "%c", *ptr);
+		}
+	}
+	ast_str_append(buf, maxlen, "\"");
+
+	return ast_str_buffer(*buf);
 }
 
 /*! \brief Send voicemail with audio file as an attachment */
@@ -1039,13 +1108,17 @@
 	struct timeval now;
 	struct ast_tm tm;
 	struct minivm_zone *the_zone = NULL;
-	int len_passdata;
 	struct ast_channel *ast;
 	char *finalfilename;
-	char *passdata = NULL;
-	char *passdata2 = NULL;
+	struct ast_str *str1 = ast_str_create(16), *str2 = ast_str_create(16);
 	char *fromaddress;
 	char *fromemail;
+
+	if (!str1 || !str2) {
+		ast_free(str1);
+		ast_free(str2);
+		return -1;
+	}
 
 	if (type == MVM_MESSAGE_EMAIL) {
 		if (vmu && !ast_strlen_zero(vmu->email)) {
@@ -1160,50 +1233,70 @@
 	if (ast_strlen_zero(fromaddress)) {
 		fprintf(p, "From: Asterisk PBX <%s>\n", who);
 	} else {
-		/* Allocate a buffer big enough for variable substitution */
-		int vmlen = strlen(fromaddress) * 3 + 200;
-
 		ast_debug(4, "Fromaddress template: %s\n", fromaddress);
-		if ((passdata = alloca(vmlen))) {
-			pbx_substitute_variables_helper(ast, fromaddress, passdata, vmlen);
-			len_passdata = strlen(passdata) * 2 + 3;
-			passdata2 = alloca(len_passdata);
-			fprintf(p, "From: %s <%s>\n", mailheader_quote(passdata, passdata2, len_passdata), who);
-		} else  {
-			ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
-			fclose(p);
-			return -1;	
+		ast_str_substitute_variables(&str1, 0, ast, fromaddress);
+		if (check_mime(ast_str_buffer(str1))) {
+			int first_line = 1;
+			char *ptr;
+			ast_str_encode_mime(&str2, 0, template->charset, ast_str_buffer(str1), strlen("From: "), strlen(who) + 3);
+			while ((ptr = strchr(ast_str_buffer(str2), ' '))) {
+				*ptr = '\0';
+				fprintf(p, "%s %s\n", first_line ? "From:" : "", ast_str_buffer(str2));
+				first_line = 0;
+				/* Substring is smaller, so this will never grow */
+				ast_str_set(&str2, 0, "%s", ptr + 1);
+			}
+			fprintf(p, "%s %s <%s>\n", first_line ? "From:" : "", ast_str_buffer(str2), who);
+		} else {
+			fprintf(p, "From: %s <%s>\n", ast_str_quote(&str2, 0, ast_str_buffer(str1)), who);
 		}
 	} 
-	ast_debug(4, "Fromstring now: %s\n", ast_strlen_zero(passdata) ? "-default-" : passdata);
 
 	fprintf(p, "Message-ID: <Asterisk-%d-%s-%d-%s>\n", (unsigned int)rand(), vmu->username, (int)getpid(), who);
-	len_passdata = strlen(vmu->fullname) * 2 + 3;
-	passdata2 = alloca(len_passdata);
-	if (!ast_strlen_zero(vmu->email))
-		fprintf(p, "To: %s <%s>\n", mailheader_quote(vmu->fullname, passdata2, len_passdata), vmu->email);
-	else
-		fprintf(p, "To: %s <%s@%s>\n", mailheader_quote(vmu->fullname, passdata2, len_passdata), vmu->username, vmu->domain);
+
+	if (ast_strlen_zero(vmu->email)) {
+		snprintf(email, sizeof(email), "%s@%s", vmu->username, vmu->domain);
+	} else {
+		ast_copy_string(email, vmu->email, sizeof(email));
+	}
+
+	if (check_mime(vmu->fullname)) {
+		int first_line = 1;
+		char *ptr;
+		ast_str_encode_mime(&str2, 0, template->charset, vmu->fullname, strlen("To: "), strlen(email) + 3);
+		while ((ptr = strchr(ast_str_buffer(str2), ' '))) {
+			*ptr = '\0';
+			fprintf(p, "%s %s\n", first_line ? "To:" : "", ast_str_buffer(str2));
+			first_line = 0;
+			/* Substring is smaller, so this will never grow */
+			ast_str_set(&str2, 0, "%s", ptr + 1);
+		}
+		fprintf(p, "%s %s <%s>\n", first_line ? "To:" : "", ast_str_buffer(str2), email);
+	} else {
+		fprintf(p, "To: %s <%s>\n", ast_str_quote(&str2, 0, vmu->fullname), email);
+	}
 
 	if (!ast_strlen_zero(template->subject)) {
-		char *pass_data;
-		int vmlen = strlen(template->subject) * 3 + 200;
-		if ((pass_data = alloca(vmlen))) {
-			pbx_substitute_variables_helper(ast, template->subject, pass_data, vmlen);
-			fprintf(p, "Subject: %s\n", pass_data);
+		ast_str_substitute_variables(&str1, 0, ast, template->subject);
+		if (check_mime(ast_str_buffer(str1))) {
+			int first_line = 1;
+			char *ptr;
+			ast_str_encode_mime(&str2, 0, template->charset, ast_str_buffer(str1), strlen("Subject: "), 0);
+			while ((ptr = strchr(ast_str_buffer(str2), ' '))) {
+				*ptr = '\0';
+				fprintf(p, "%s %s\n", first_line ? "Subject:" : "", ast_str_buffer(str2));
+				first_line = 0;
+				/* Substring is smaller, so this will never grow */
+				ast_str_set(&str2, 0, "%s", ptr + 1);
+			}
+			fprintf(p, "%s %s\n", first_line ? "Subject:" : "", ast_str_buffer(str2));
 		} else {
-			ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
-			fclose(p);
-			return -1;	
-		}
-
-		ast_debug(4, "Subject now: %s\n", pass_data);
-
-	} else  {
+			fprintf(p, "Subject: %s\n", ast_str_buffer(str1));
+		}
+	} else {
 		fprintf(p, "Subject: New message in mailbox %s@%s\n", vmu->username, vmu->domain);
 		ast_debug(1, "Using default subject for this email \n");
 	}
-
 
 	if (option_debug > 2)
 		fprintf(p, "X-Asterisk-debug: template %s user account %s@%s\n", template->name, vmu->username, vmu->domain);
@@ -1215,19 +1308,13 @@
 	fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"\n\n\n", bound);
 
 	fprintf(p, "--%s\n", bound);
-	fprintf(p, "Content-Type: text/plain; charset=%s\nContent-Transfer-Encoding: 8bit\n\n", global_charset);
+	fprintf(p, "Content-Type: text/plain; charset=%s\nContent-Transfer-Encoding: 8bit\n\n", template->charset);
 	if (!ast_strlen_zero(template->body)) {
-		char *pass_data;
-		int vmlen = strlen(template->body)*3 + 200;
-		if ((pass_data = alloca(vmlen))) {
-			pbx_substitute_variables_helper(ast, template->body, pass_data, vmlen);
-			ast_debug(3, "Message now: %s\n-----\n", pass_data);
-			fprintf(p, "%s\n", pass_data);
-		} else
-			ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
+		ast_str_substitute_variables(&str1, 0, ast, template->body);
+		ast_debug(3, "Message now: %s\n-----\n", ast_str_buffer(str1));
+		fprintf(p, "%s\n", ast_str_buffer(str1));
 	} else {
 		fprintf(p, "Dear %s:\n\n\tJust wanted to let you know you were just left a %s long message \n"
-
 			"in mailbox %s from %s, on %s so you might\n"
 			"want to check it when you get a chance.  Thanks!\n\n\t\t\t\t--Asterisk\n\n", vmu->fullname, 
 			dur,  vmu->username, (cidname ? cidname : (cidnum ? cidnum : "an unknown caller")), date);
@@ -1256,6 +1343,8 @@
 	ast_debug(3, "Actual command used: %s\n", tmp2);
 	if (ast)
 		ast_channel_free(ast);
+	ast_free(str1);
+	ast_free(str2);
 	return 0;
 }
 
@@ -2611,7 +2700,6 @@
 	ast_copy_string(default_vmformat, "wav", sizeof(default_vmformat));
 	ast_set2_flag((&globalflags), FALSE, MVM_REVIEW);	
 	ast_set2_flag((&globalflags), FALSE, MVM_OPERATOR);	
-	strcpy(global_charset, "ISO-8859-1");
 	/* Reset statistics */
 	memset(&global_stats, 0, sizeof(global_stats));
 	global_stats.reset = ast_tvnow();

Modified: team/tilghman/str_substitution/main/pbx.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/main/pbx.c?view=diff&rev=178204&r1=178203&r2=178204
==============================================================================
--- team/tilghman/str_substitution/main/pbx.c (original)
+++ team/tilghman/str_substitution/main/pbx.c Mon Feb 23 20:49:37 2009
@@ -3381,19 +3381,33 @@
 	char *copy = ast_strdupa(function);
 	char *args = func_args(copy);
 	struct ast_custom_function *acfptr = ast_custom_function_find(copy);
-
-	if (acfptr == NULL)
+	int res;
+	struct ast_module_user *u = NULL;
+
+	if (acfptr == NULL) {
 		ast_log(LOG_ERROR, "Function %s not registered\n", copy);
-	else if (!acfptr->read)
+	} else if (!acfptr->read && !acfptr->read2) {
 		ast_log(LOG_ERROR, "Function %s cannot be read\n", copy);
-	else {
-		int res;
-		struct ast_module_user *u = NULL;
-		if (acfptr->mod)
+	} else if (acfptr->read) {
+		if (acfptr->mod) {
 			u = __ast_module_user_add(acfptr->mod, chan);
+		}
 		res = acfptr->read(chan, copy, args, workspace, len);
-		if (acfptr->mod && u)
+		if (acfptr->mod && u) {
 			__ast_module_user_remove(acfptr->mod, u);
+		}
+		return res;
+	} else {
+		struct ast_str *str = ast_str_create(16);
+		if (acfptr->mod) {
+			u = __ast_module_user_add(acfptr->mod, chan);
+		}
+		res = acfptr->read2(chan, copy, args, &str, 0);
+		if (acfptr->mod && u) {
+			__ast_module_user_remove(acfptr->mod, u);
+		}
+		ast_copy_string(workspace, ast_str_buffer(str), len > ast_str_size(str) ? ast_str_size(str) : len);
+		ast_free(str);
 		return res;
 	}
 	return -1;
@@ -3404,16 +3418,17 @@
 	char *copy = ast_strdupa(function);
 	char *args = func_args(copy);
 	struct ast_custom_function *acfptr = ast_custom_function_find(copy);
+	int res;
+	struct ast_module_user *u = NULL;
 
 	if (acfptr == NULL) {
 		ast_log(LOG_ERROR, "Function %s not registered\n", copy);
 	} else if (!acfptr->read && !acfptr->read2) {
 		ast_log(LOG_ERROR, "Function %s cannot be read\n", copy);
 	} else {
-		int res;
-		struct ast_module_user *u = NULL;
-		if (acfptr->mod)
+		if (acfptr->mod) {
 			u = __ast_module_user_add(acfptr->mod, chan);
+		}
 		if (acfptr->read2) {
 			/* ast_str enabled */
 			ast_str_reset(*str);
@@ -3425,8 +3440,9 @@
 			}
 			res = acfptr->read(chan, copy, args, ast_str_buffer(*str), maxlen > 0 ? maxlen : maxlen < 0 ? ast_str_size(*str) : VAR_BUF_SIZE);
 		}
-		if (acfptr->mod && u)
+		if (acfptr->mod && u) {
 			__ast_module_user_remove(acfptr->mod, u);
+		}
 		return res;
 	}
 	return -1;




More information about the asterisk-commits mailing list