]> www.average.org Git - pam_pcsc_cr.git/blobdiff - pam_cr_setup.c
configure.ac: remove sanitizer by default
[pam_pcsc_cr.git] / pam_cr_setup.c
index af4e11626ff394b3a21fd414a3925e6f78eecd06..0a5f1f4393488338fecf9426057ec5e388cc52e0 100644 (file)
@@ -35,11 +35,11 @@ freely, subject to the following restrictions:
 #include "pcsc_cr.h"
 
 static struct _auth_chunk
 #include "pcsc_cr.h"
 
 static struct _auth_chunk
-token_key(const unsigned char *challenge, const int challengesize)
+token_key(const unsigned char *challenge, const size_t challengesize)
 {
        struct _auth_chunk ho = {0};
        long rc;
 {
        struct _auth_chunk ho = {0};
        long rc;
-       int keysize = sizeof(ho.data);
+       size_t keysize = sizeof(ho.data);
 
        if ((rc = pcsc_cr(challenge, challengesize, ho.data, &keysize))) {
                ho.err = pcsc_errstr(rc);
 
        if ((rc = pcsc_cr(challenge, challengesize, ho.data, &keysize))) {
                ho.err = pcsc_errstr(rc);
@@ -49,7 +49,7 @@ token_key(const unsigned char *challenge, const int challengesize)
 
 static char *mynonce = NULL;
 
 
 static char *mynonce = NULL;
 
-static void update_nonce(char *nonce, const int nonsize)
+static void update_nonce(char *nonce, const size_t nonsize)
 {
        if (mynonce) {
                snprintf(nonce, nonsize, "%s", mynonce);
 {
        if (mynonce) {
                snprintf(nonce, nonsize, "%s", mynonce);
@@ -70,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"
@@ -89,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]);
@@ -124,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;
@@ -192,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);
@@ -202,8 +197,8 @@ int main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        } else if (verbose) {
                printf("version: %s\n", VERSION);
                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", (int)ao.datasize, ao.data);
+               printf("payload: \"%.*s\"\n", (int)ao.paylsize, ao.payload);
        }
        if (ao.buffer) free(ao.buffer);
        return 0;
        }
        if (ao.buffer) free(ao.buffer);
        return 0;