Add TRUSTED_CONFIG_PREFIX_FILE option
[exim.git] / src / src / srs.c
index 6d49a6d271e44bb84d9bd60ee2a2d551545fe06e..69f35bf999dd5ee973d7e9d453d3d3fe65a53237 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/srs.c,v 1.5 2005/05/24 08:15:02 tom Exp $ */
+/* $Cambridge: exim/src/src/srs.c,v 1.8 2005/06/27 18:10:30 tom Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -29,11 +29,11 @@ int eximsrs_init()
 {
   uschar *list = srs_config;
   uschar secret_buf[SRS_MAX_SECRET_LENGTH];
-  uschar *secret;
+  uschar *secret = NULL;
   uschar sbuf[4];
   uschar *sbufp;
 
-  // Check if this instance of Exim has not initialized SRS
+  /* Check if this instance of Exim has not initialized SRS */
   if(srs == NULL)
   {
     int co = 0;
@@ -71,7 +71,7 @@ int eximsrs_init()
     /* First secret specified in secrets? */
     co = 0;
     list = srs_secrets;
-    if(secret == NULL)
+    if(secret == NULL || *secret == '\0')
     {
       if((secret = string_nextinlist(&list, &co, secret_buf, SRS_MAX_SECRET_LENGTH)) == NULL)
       {
@@ -107,7 +107,7 @@ int eximsrs_init()
 
     /* Extra secrets? */
     while((secret = string_nextinlist(&list, &co, secret_buf, SRS_MAX_SECRET_LENGTH)) != NULL)
-        srs_add_secret(srs, secret, strnlen(secret, SRS_MAX_SECRET_LENGTH));
+        srs_add_secret(srs, secret, (Ustrlen(secret) > SRS_MAX_SECRET_LENGTH) ? SRS_MAX_SECRET_LENGTH :  Ustrlen(secret));
 
     DEBUG(D_any)
       debug_printf("SRS initialized\n");