Browse Source

Ticket 48978 - refactor LDADebug() to slapi_log_err()

Description:  Fix refactoring errors that were missed due to missing "-Werror=format-security"
              in configure command

https://fedorahosted.org/389/ticket/48978

Reviewed by: wibrown
Mark Reynolds 9 years ago
parent
commit
9464bc8632

+ 3 - 3
ldap/servers/plugins/replication/windows_private.c

@@ -932,14 +932,14 @@ create_subtree_pairs(char **pairs)
 		p1 = ldap_utf8strtok_r(NULL, ":", &saveptr);
 		if ((NULL == p0) || (NULL == p1)) {
 			slapi_log_err(SLAPI_LOG_ERR,
-			              "create_subtree_pairs: "
+			              "create_subtree_pairs",
 			              "Ignoring invalid subtree pairs \"%s\".\n", *ptr);
 			continue;
 		}
 		spp->DSsubtree = slapi_sdn_new_dn_byval(p0);
 		if (NULL == spp->DSsubtree) {
 			slapi_log_err(SLAPI_LOG_ERR,
-			              "create_subtree_pairs: "
+			              "create_subtree_pairs",
 			              "Ignoring invalid DS subtree \"%s\".\n",
 			              p0);
 			continue;
@@ -947,7 +947,7 @@ create_subtree_pairs(char **pairs)
 		spp->ADsubtree = slapi_sdn_new_dn_byval(p1);
 		if (NULL == spp->ADsubtree) {
 			slapi_log_err(SLAPI_LOG_ERR,
-			              "create_subtree_pairs: "
+			              "create_subtree_pairs",
 			              "Ignoring invalid AD subtree \"%s\".\n",
 			              p1);
 			slapi_sdn_free(&(spp->DSsubtree));

+ 1 - 1
ldap/servers/slapd/back-ldbm/dblayer.c

@@ -511,7 +511,7 @@ void dblayer_log_print(const char* prefix, char *buffer)
 #endif
 {
     /* We ignore the prefix since we know who we are anyway */
-    slapi_log_err(SLAPI_LOG_ERR,"libdb - %s\n", (char *)buffer);    
+    slapi_log_err(SLAPI_LOG_ERR,"libdb","%s\n", (char *)buffer);    
 }
 
 void dblayer_remember_disk_filled(struct ldbminfo *li)

+ 2 - 3
ldap/servers/slapd/back-ldbm/ldbm_bind.c

@@ -48,9 +48,8 @@ ldbm_back_bind( Slapi_PBlock *pb )
 	if (inst->inst_ref_count) {
 		slapi_counter_increment(inst->inst_ref_count);
 	} else {
-		slapi_log_err(SLAPI_LOG_ERR,
-		              "ldbm_back_bind - instance %s does not exist.\n",
-		              inst->inst_name);
+		slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_bind",
+			"instance %s does not exist.\n", inst->inst_name);
 		return( SLAPI_BIND_FAIL );
 	}
 

+ 1 - 1
ldap/servers/slapd/back-ldbm/ldbm_compare.c

@@ -48,7 +48,7 @@ ldbm_back_compare( Slapi_PBlock *pb )
 	if (inst && inst->inst_ref_count) {
 		slapi_counter_increment(inst->inst_ref_count);
 	} else {
-		slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_compare - "
+		slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_compare",
 			"Instance \"%s\" does not exist.\n",
 			inst ? inst->inst_name : "null instance");
 		return -1;

+ 9 - 9
ldap/servers/slapd/back-ldbm/misc.c

@@ -224,8 +224,9 @@ allinstance_set_busy(struct ldbminfo *li)
         inst_obj = objset_next_obj(li->li_instance_set, inst_obj)) {
         inst = (ldbm_instance *)object_get_data(inst_obj);
         if (instance_set_busy(inst)) {
-            slapi_log_err(SLAPI_LOG_TRACE, "could not set instance [%s] as busy, probably already busy\n",
-                      inst->inst_name);
+            slapi_log_err(SLAPI_LOG_TRACE, "allinstance_set_busy",
+                    "Could not set instance [%s] as busy, probably already busy\n",
+                    inst->inst_name);
         }
     }
 }
@@ -328,7 +329,7 @@ mkdir_p(char *dir, unsigned int mode)
             PR_Delete(dir);
             if (PR_SUCCESS != PR_MkDir(dir, mode))
             {
-                slapi_log_err(SLAPI_LOG_ERR, "mkdir_p - %s: error %d (%s)\n",
+                slapi_log_err(SLAPI_LOG_ERR, "mkdir_p","%s: error %d (%s)\n",
                     dir, PR_GetError(),slapd_pr_strerror(PR_GetError()));
                 return -1;
             }
@@ -364,7 +365,7 @@ mkdir_p(char *dir, unsigned int mode)
             return rval;
         if (PR_SUCCESS != PR_MkDir(dir, mode))
         {
-            slapi_log_err(SLAPI_LOG_ERR, "mkdir_p - %s: error %d (%s)\n",
+            slapi_log_err(SLAPI_LOG_ERR, "mkdir_p", "%s: error %d (%s)\n",
                     dir, PR_GetError(),slapd_pr_strerror(PR_GetError()));
             return -1;
         }
@@ -536,8 +537,8 @@ get_value_from_string(const char *string, char *type, char **value)
         rc = slapi_ldif_parse_line(copy, &tmptype, &bvvalue, &freeval);
         if (0 > rc || NULL == tmptype.bv_val ||
             NULL == bvvalue.bv_val || 0 >= bvvalue.bv_len) {
-            slapi_log_err(SLAPI_LOG_ERR, "get_value_from_string", "parse "
-                                             "failed: %d\n", rc);
+            slapi_log_err(SLAPI_LOG_ERR, "get_value_from_string",
+                    "parse failed: %d\n", rc);
             if (freeval) {
                 slapi_ch_free_string(&bvvalue.bv_val);
             }
@@ -545,9 +546,8 @@ get_value_from_string(const char *string, char *type, char **value)
             goto bail;
         }
         if (0 != PL_strncasecmp(type, tmptype.bv_val, tmptype.bv_len)) {
-            slapi_log_err(SLAPI_LOG_ERR, "get_value_from_string", "type "
-                                             "does not match: %s != %s\n", 
-                                             type, tmptype.bv_val);
+            slapi_log_err(SLAPI_LOG_ERR, "get_value_from_string",
+                    "type does not match: %s != %s\n", type, tmptype.bv_val);
             if (freeval) {
                 slapi_ch_free_string(&bvvalue.bv_val);
             }

+ 1 - 1
ldap/servers/slapd/bind.c

@@ -203,7 +203,7 @@ do_bind( Slapi_PBlock *pb )
             static char *kmsg = 
                 "LDAPv2-style kerberos authentication received "
                 "on LDAPv3 connection.";
-            slapi_log_err(SLAPI_LOG_ERR, "do_bind", kmsg);
+            slapi_log_err(SLAPI_LOG_ERR, "do_bind", "%s", kmsg);
             log_bind_access (pb, dn?dn:"empty", method, version, saslmech, kmsg);
             send_ldap_result( pb, LDAP_PROTOCOL_ERROR, NULL,
                               kmsg, 0, NULL );

+ 2 - 2
ldap/servers/slapd/detach.c

@@ -89,7 +89,7 @@ set_workingdir(void)
 				rc = chdir("/");
 				if (0 == rc) {
 					if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, "/", errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
-						slapi_log_err(SLAPI_LOG_ERR, "detach: set workingdir failed with \"%s\"\n", errorbuf);
+						slapi_log_err(SLAPI_LOG_ERR, "set_workingdir", "detach: set workingdir failed with \"%s\"\n", errorbuf);
 					}
 				} else {
 					slapi_log_err(SLAPI_LOG_ERR, "set_workingdir", "detach: failed to chdir to %s\n", "/");
@@ -104,7 +104,7 @@ set_workingdir(void)
 			rc = chdir("/");
 			if (0 == rc) {
 				if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, "/", errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
-					slapi_log_err(SLAPI_LOG_ERR, "detach: set workingdir failed with \"%s\"\n", errorbuf);
+					slapi_log_err(SLAPI_LOG_ERR, "set_workingdir", "detach: set workingdir failed with \"%s\"\n", errorbuf);
 				}
 			} else {
 				slapi_log_err(SLAPI_LOG_ERR, "set_workingdir", "detach: failed to chdir to %s\n", "/");

+ 4 - 4
ldap/servers/slapd/entry.c

@@ -325,7 +325,7 @@ str2entry_fast( const char *rawdn, const Slapi_RDN *srdn, char *s, int flags, in
 						normdn = slapi_create_dn_string("%s", rawdn);
 						if (NULL == normdn) {
 							slapi_log_err(SLAPI_LOG_TRACE,
-							     "str2entry_fast: Invalid DN: %s\n", (char *)rawdn);
+							     "str2entry_fast", "Invalid DN: %s\n", (char *)rawdn);
 							slapi_entry_free( e );
 							if (freeval) slapi_ch_free_string(&value.bv_val);
 							e = NULL;
@@ -864,7 +864,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 				} else {
 					normdn = slapi_create_dn_string("%s", rawdn);
 					if (NULL == normdn) {
-						slapi_log_err(SLAPI_LOG_TRACE, "str2entry_dupcheck"
+						slapi_log_err(SLAPI_LOG_TRACE, "str2entry_dupcheck",
 						    "nvalid DN: %s\n", (char *)rawdn);
 						slapi_entry_free( e );
 						if (freeval) slapi_ch_free_string(&bvvalue.bv_val);
@@ -887,7 +887,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 					} else {
 						normdn = slapi_create_dn_string("%s", rawdn);
 						if (NULL == normdn) {
-						slapi_log_err(SLAPI_LOG_TRACE, "str2entry_dupcheck"
+						slapi_log_err(SLAPI_LOG_TRACE, "str2entry_dupcheck",
 							     "Invalid DN: %s\n", (char *)rawdn);
 							slapi_entry_free( e );
 							if (freeval) slapi_ch_free_string(&bvvalue.bv_val);
@@ -918,7 +918,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 			}
 			normdn = slapi_create_dn_string("%s", valuecharptr);
 			if (NULL == normdn) {
-				slapi_log_err(SLAPI_LOG_TRACE, "str2entry_dupcheck"
+				slapi_log_err(SLAPI_LOG_TRACE, "str2entry_dupcheck",
 						"Invalid DN: %s\n", valuecharptr);
 				slapi_entry_free( e ); e = NULL;
 				if (freeval) slapi_ch_free_string(&bvvalue.bv_val);

+ 1 - 1
ldap/servers/slapd/main.c

@@ -2064,7 +2064,7 @@ slapd_exemode_ldif2db(void)
 
     plugin = lookup_plugin_by_instance_name(cmd_line_instance_name);
     if (plugin == NULL) {
-        slapi_log_err(SLAPI_LOG_ERR, 
+        slapi_log_err(SLAPI_LOG_ERR, "slapd_exemode_ldif2db",
                   "Could not find backend '%s'.\n",
                   cmd_line_instance_name);
         return 1;

+ 2 - 2
ldap/servers/slapd/saslbind.c

@@ -320,8 +320,8 @@ static Slapi_Entry *ids_sasl_user_to_entry(
                 slapi_log_err(SLAPI_LOG_TRACE, "ids_sasl_user_to_entry",
                         "sasl user search found no entries matchingfilter=%s\n", filter);
             } else {
-                slapi_log_err(SLAPI_LOG_TRACE, "sasl user search found more than one entry "
-                    "matching filter=%s\n", filter);
+                slapi_log_err(SLAPI_LOG_TRACE, "ids_sasl_user_to_entry",
+                        "sasl user search found more than one entry matching filter=%s\n", filter);
                 if (entry) {
                     slapi_entry_free(entry);
                     entry = NULL;

+ 10 - 7
ldap/servers/slapd/snmp_collator.c

@@ -457,21 +457,24 @@ snmp_collator_create_semaphore(void)
             /* It appears that we didn't exit cleanly last time and left the semaphore
              * around.  Recreate it since we don't know what state it is in. */
             if (sem_unlink(stats_sem_name) != 0) {
-                slapi_log_err(SLAPI_LOG_EMERG, "snmp_collator_create_semaphore - Failed to delete old semaphore for stats file (%s). "
-                          "Error %d (%s).\n", szStatsFile, errno, slapd_system_strerror(errno) );
+                slapi_log_err(SLAPI_LOG_EMERG, "snmp_collator_create_semaphore",
+                        "Failed to delete old semaphore for stats file (%s). "
+                        "Error %d (%s).\n", szStatsFile, errno, slapd_system_strerror(errno) );
                 exit(1);
             }
 
             if ((stats_sem = sem_open(stats_sem_name, O_CREAT | O_EXCL, SLAPD_DEFAULT_FILE_MODE, 1)) == SEM_FAILED) {
                 /* No dice */
-                slapi_log_err(SLAPI_LOG_EMERG, "snmp_collator_create_semaphore - Failed to create semaphore for stats file (%s). Error %d (%s).\n",
-                         szStatsFile, errno, slapd_system_strerror(errno) );
+                slapi_log_err(SLAPI_LOG_EMERG, "snmp_collator_create_semaphore",
+                        "Failed to create semaphore for stats file (%s). Error %d (%s).\n",
+                        szStatsFile, errno, slapd_system_strerror(errno) );
                 exit(1);
             }
         } else {
             /* Some other problem occurred creating the semaphore. */
-            slapi_log_err(SLAPI_LOG_EMERG, "snmp_collator_create_semaphore - Failed to create semaphore for stats file (%s). Error %d.(%s)\n",
-                     szStatsFile, errno, slapd_system_strerror(errno) );
+            slapi_log_err(SLAPI_LOG_EMERG, "snmp_collator_create_semaphore",
+                    "Failed to create semaphore for stats file (%s). Error %d.(%s)\n",
+                    szStatsFile, errno, slapd_system_strerror(errno) );
             exit(1);
         }
     }
@@ -495,7 +498,7 @@ snmp_collator_sem_wait(void)
 
     if (SEM_FAILED == stats_sem) {
         slapi_log_err(SLAPI_LOG_ERR,
-           "snmp_collator_sem_wait - semaphore for stats file (%s) is not available.\n", szStatsFile);
+           "snmp_collator_sem_wait", "semaphore for stats file (%s) is not available.\n", szStatsFile);
         return;
     }
 

+ 4 - 2
ldap/servers/slapd/time.c

@@ -517,7 +517,8 @@ parse_duration(char *value)
     duration *= times;
 bail:
     if (duration == -1) {
-        slapi_log_err(SLAPI_LOG_ERR, "parse_duration - Invalid duration (%s)\n", value?value:"null");
+        slapi_log_err(SLAPI_LOG_ERR, "parse_duration",
+                "Invalid duration (%s)\n", value?value:"null");
     }
     slapi_ch_free_string(&input);
     return duration;
@@ -584,7 +585,8 @@ parse_duration_longlong(char *value)
     duration *= times;
 bail:
     if (duration == -1) {
-        slapi_log_err(SLAPI_LOG_ERR, "parse_duration_longlong - Invalid duration (%s)\n", value?value:"null");
+        slapi_log_err(SLAPI_LOG_ERR, "parse_duration_longlong",
+                "Invalid duration (%s)\n", value?value:"null");
     }
     slapi_ch_free_string(&input);
     return duration;