stroke: List proposals in statusall without leading '/' in AH SAs
authorMartin Willi <martin@revosec.ch>
Thu, 20 Jun 2013 14:16:06 +0000 (16:16 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 11 Oct 2013 08:15:21 +0000 (10:15 +0200)
src/libcharon/plugins/stroke/stroke_list.c

index a582551..ea16805 100644 (file)
@@ -245,6 +245,7 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
                                u_int16_t encr_alg = ENCR_UNDEFINED, int_alg = AUTH_UNDEFINED;
                                u_int16_t encr_size = 0, int_size = 0;
                                u_int16_t esn = NO_EXT_SEQ_NUMBERS;
+                               bool first = TRUE;
 
                                proposal->get_algorithm(proposal, ENCRYPTION_ALGORITHM,
                                                                                &encr_alg, &encr_size);
@@ -256,6 +257,7 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
                                if (encr_alg != ENCR_UNDEFINED)
                                {
                                        fprintf(out, "%N", encryption_algorithm_names, encr_alg);
+                                       first = FALSE;
                                        if (encr_size)
                                        {
                                                fprintf(out, "_%u", encr_size);
@@ -263,7 +265,11 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
                                }
                                if (int_alg != AUTH_UNDEFINED)
                                {
-                                       fprintf(out, "/%N", integrity_algorithm_names, int_alg);
+                                       if (!first)
+                                       {
+                                               fprintf(out, "/");
+                                       }
+                                       fprintf(out, "%N", integrity_algorithm_names, int_alg);
                                        if (int_size)
                                        {
                                                fprintf(out, "_%u", int_size);