]> www.average.org Git - pam_pcsc_cr.git/blobdiff - pam_cr_setup.c
bump version
[pam_pcsc_cr.git] / pam_cr_setup.c
index 8a42a74e3886c5128b3a925e795933d75da93a6a..612747ab80913e03d9c5e2cc0e49323b32d79dcf 100644 (file)
@@ -1,3 +1,26 @@
+/*
+Copyright (c) 2013 Eugene Crosser
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+    1. The origin of this software must not be misrepresented; you must
+    not claim that you wrote the original software. If you use this
+    software in a product, an acknowledgment in the product documentation
+    would be appreciated but is not required.
+
+    2. Altered source versions must be plainly marked as such, and must
+    not be misrepresented as being the original software.
+
+    3. This notice may not be removed or altered from any source
+    distribution.
+*/
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
@@ -47,7 +70,6 @@ static void usage(const char * const cmd)
                "    -f template       - template for auth state filepath\n"
                "    -a secret | -A file-with-secret | -A -\n"
                "                      - 40-character hexadecimal secret\n"
                "    -f template       - template for auth state filepath\n"
                "    -a secret | -A file-with-secret | -A -\n"
                "                      - 40-character hexadecimal secret\n"
-               "    -s token-serial   - public I.D. of the token\n"
                "    -n nonce          - initial nonce\n"
                "    -l payload        - keyring unlock password\n"
                "    -p password       - login password\n"
                "    -n nonce          - initial nonce\n"
                "    -l payload        - keyring unlock password\n"
                "    -p password       - login password\n"
@@ -66,12 +88,11 @@ int main(int argc, char *argv[])
        unsigned char bsecret[20];
        unsigned char *secret = NULL;
        int i;
        unsigned char bsecret[20];
        unsigned char *secret = NULL;
        int i;
-       char *tokenid = NULL;
        char *userid = getlogin();
        char *payload = NULL;
        char *password = "";
 
        char *userid = getlogin();
        char *payload = NULL;
        char *password = "";
 
-       while ((c = getopt(argc, argv, "ho:f:a:A:s:n:l:p:v")) != -1)
+       while ((c = getopt(argc, argv, "ho:f:a:A:n:l:p:v")) != -1)
            switch (c) {
        case 'h':
                usage(argv[0]);
            switch (c) {
        case 'h':
                usage(argv[0]);
@@ -101,9 +122,6 @@ int main(int argc, char *argv[])
                        exit(EXIT_FAILURE);
                }
                break;
                        exit(EXIT_FAILURE);
                }
                break;
-       case 's':
-               tokenid = optarg;
-               break;
        case 'n':
                mynonce = optarg;
                break;
        case 'n':
                mynonce = optarg;
                break;
@@ -169,7 +187,7 @@ int main(int argc, char *argv[])
                        sscanf(hsecret + i * 2, "%2hhx", &bsecret[i]);
                secret = bsecret;
        }
                        sscanf(hsecret + i * 2, "%2hhx", &bsecret[i]);
                secret = bsecret;
        }
-       ao = authfile(tokenid, userid, password, update_nonce,
+       ao = authfile(userid, password, update_nonce,
                        secret, secret ? sizeof(bsecret) : 0,
                        (unsigned char *)payload, payload ? strlen(payload) : 0,
                        token_key);
                        secret, secret ? sizeof(bsecret) : 0,
                        (unsigned char *)payload, payload ? strlen(payload) : 0,
                        token_key);
@@ -178,6 +196,7 @@ int main(int argc, char *argv[])
                fprintf(stderr, "%s\n", ao.err);
                exit(EXIT_FAILURE);
        } else if (verbose) {
                fprintf(stderr, "%s\n", ao.err);
                exit(EXIT_FAILURE);
        } else if (verbose) {
+               printf("version: %s\n", VERSION);
                printf("userid : \"%.*s\"\n", ao.datasize, ao.data);
                printf("payload: \"%.*s\"\n", ao.paylsize, ao.payload);
        }
                printf("userid : \"%.*s\"\n", ao.datasize, ao.data);
                printf("payload: \"%.*s\"\n", ao.paylsize, ao.payload);
        }