diff options
| author | rcritten <> | 2008-07-02 14:54:06 +0000 |
|---|---|---|
| committer | rcritten <> | 2008-07-02 14:54:06 +0000 |
| commit | 3b2e9ed67b9d67169c4e32d6e2d2a095109d3c10 (patch) | |
| tree | c261816601d14f99b98113591459d46cadb6eeea | |
| parent | 80f966c2bf3e8b1582155659675838eb0b8beaee (diff) | |
| download | mod_nss-3b2e9ed67b9d67169c4e32d6e2d2a095109d3c10.tar.gz mod_nss-3b2e9ed67b9d67169c4e32d6e2d2a095109d3c10.tar.xz mod_nss-3b2e9ed67b9d67169c4e32d6e2d2a095109d3c10.zip | |
Fix parsing error where a token with no password would end up with a
trailing tab in its value causing NSS to not find it.
If there is no password stored for a token return a 1-byte response
so that the read on the other end won't time out.
| -rw-r--r-- | nss_pcache.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/nss_pcache.c b/nss_pcache.c index 8e0f70f..762dcb7 100644 --- a/nss_pcache.c +++ b/nss_pcache.c @@ -410,7 +410,10 @@ int main(int argc, char ** argv) for (node = pinList; node != NULL; node = node->next) { if (!strcmp(node->tokenName, tokenName)) { if (Pk11StoreGetPin(&pin, node->store) == SECSuccess) { - PR_Write(out, pin, strlen(pin)); + if (strlen(pin) == 0) + PR_Write(out, "", 1); + else + PR_Write(out, pin, strlen(pin)); memset(pin, 0, strlen(pin)); free(pin); found = PR_TRUE; @@ -453,7 +456,7 @@ char * getstr(const char * cmd, int el) { while (*s) { if (*s == '\t' || *s == '\0') { if (i == el) { - if (*peek != '\0') + if (*peek != '\0' || *s == '\t') *s = '\0'; r = strdup(t); free(work); |
