changeset 17462:a07ddd1b2763

auth: passdb/userdb dict settings file parsing didn't handle errors correctly. Found by Coverity
author Timo Sirainen <tss@iki.fi>
date Fri, 13 Jun 2014 00:15:47 +0300
parents 2e239d925c09
children 9b1734587b28
files src/auth/db-dict.c
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/db-dict.c	Fri Jun 13 00:09:23 2014 +0300
+++ b/src/auth/db-dict.c	Fri Jun 13 00:15:47 2014 +0300
@@ -206,10 +206,14 @@
 		return FALSE;
 	}
 	if (strcmp(type, "key") == 0) {
-		if (name == NULL)
-			return "Key section is missing name";
-		if (strchr(name, '.') != NULL)
-			return "Key section names must not contain '.'";
+		if (name == NULL) {
+			*errormsg = "Key section is missing name";
+			return FALSE;
+		}
+		if (strchr(name, '.') != NULL) {
+			*errormsg = "Key section names must not contain '.'";
+			return FALSE;
+		}
 		ctx->section = DICT_SETTINGS_SECTION_KEY;
 		ctx->cur_key = array_append_space(&ctx->conn->set.keys);
 		*ctx->cur_key = default_key_settings;