changeset 22734:d5d2a69361d6

doveadm-auth-server: Send comma only if we are sending field too Fixes json output
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Wed, 15 Nov 2017 10:28:37 +0200
parents 4fac345a9549
children 5644a112b44f
files src/doveadm/doveadm-auth-server.c
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/doveadm/doveadm-auth-server.c	Thu Nov 09 16:30:34 2017 +0200
+++ b/src/doveadm/doveadm-auth-server.c	Wed Nov 15 10:28:37 2017 +0200
@@ -228,6 +228,7 @@
 {
 	string_t *jvalue = t_str_new(128);
 	if (show_field != NULL && strcmp(show_field, key) != 0) return;
+	o_stream_nsend_str(doveadm_print_ostream, ",");
 	json_append_escaped(jvalue, key);
 	o_stream_nsend_str(doveadm_print_ostream, "\"");
 	o_stream_nsend_str(doveadm_print_ostream, str_c(jvalue));
@@ -253,13 +254,10 @@
 		o_stream_nsend_str(doveadm_print_ostream, ",");
 	}
 	cmd_user_mail_input_field("uid", user->set->mail_uid, show_field);
-	o_stream_nsend_str(doveadm_print_ostream, ",");
 	cmd_user_mail_input_field("gid", user->set->mail_gid, show_field);
-	o_stream_nsend_str(doveadm_print_ostream, ",");
 	cmd_user_mail_input_field("home", user->set->mail_home, show_field);
 
 	mail_set = mail_user_set_get_storage_set(user);
-	o_stream_nsend_str(doveadm_print_ostream, ",");
 	cmd_user_mail_input_field("mail", mail_set->mail_location, show_field);
 
 	if (userdb_fields != NULL) {
@@ -276,7 +274,6 @@
 			    strcmp(key, "home") != 0 &&
 			    strcmp(key, "mail") != 0 &&
 			    *key != '\0') {
-				o_stream_nsend_str(doveadm_print_ostream, ",");
 				cmd_user_mail_input_field(key, value, show_field);
 			}
 		}