]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
If the subject-name begins with @, prefix it with the certname
authorHarlan Stenn <stenn@ntp.org>
Fri, 7 Jan 2011 04:06:38 +0000 (23:06 -0500)
committerHarlan Stenn <stenn@ntp.org>
Fri, 7 Jan 2011 04:06:38 +0000 (23:06 -0500)
bk: 4d26914eGB1S7o2N74yy0tfy1Ng6GA

util/ntp-keygen.c

index 6375ce01c0397f0664380765a752c7da0486f8ab..35fba58bf5b37f71b35ebd7d81fb98923bd66d73 100644 (file)
@@ -238,6 +238,7 @@ main(
        EVP_PKEY *pkey = NULL;  /* temp key */
        const EVP_MD *ectx;     /* EVP digest */
        char    pathbuf[MAXFILENAME + 1];
+       char    str[MAXFILENAME + 1];
        const char *scheme = NULL; /* digest/signature scheme */
        char    *exten = NULL;  /* private extension */
        char    *grpkey = NULL; /* identity extension */
@@ -325,8 +326,15 @@ main(
        if (HAVE_OPT( CERTIFICATE ))
                scheme = OPT_ARG( CERTIFICATE );
 
-       if (HAVE_OPT( SUBJECT_NAME ))
-               certname = strdup(OPT_ARG( SUBJECT_NAME ));
+       if (HAVE_OPT( SUBJECT_NAME )) {
+               if (*OPT_ARG(SUBJECT_NAME) != '@') {
+                       certname = strdup(OPT_ARG(SUBJECT_NAME));
+               } else {
+                       strcpy(str, certname);
+                       strcat(str, OPT_ARG(SUBJECT_NAME));
+                       certname = strdup(str);
+               }
+       }
 
        if (HAVE_OPT( ISSUER_NAME ))
                groupname = strdup(OPT_ARG( ISSUER_NAME ));