diff options
author | Thorsten Kukuk <kukuk@thkukuk.de> | 2009-02-25 17:05:22 +0000 |
---|---|---|
committer | Thorsten Kukuk <kukuk@thkukuk.de> | 2009-02-25 17:05:22 +0000 |
commit | 48a26b6141fb6bf276208bc1a06f5105880e843e (patch) | |
tree | defea3b1a9bc97dd09ec62f62129cdf37666ad9e /tests/tst-pam_mkargv.c | |
parent | 1376c1565abb318a5b4d086edd7f295ee3da6b13 (diff) | |
download | pam-48a26b6141fb6bf276208bc1a06f5105880e843e.tar.gz pam-48a26b6141fb6bf276208bc1a06f5105880e843e.tar.bz2 pam-48a26b6141fb6bf276208bc1a06f5105880e843e.zip |
Relevant BUGIDs:
Purpose of commit: bugfix
Commit summary:
---------------
2009-02-25 Thorsten Kukuk <kukuk@thkukuk.de>
* libpam/pam_misc.c (_pam_StrTok): Use unsigned char
instead of int. Reported by Marcus Granado.
* tests/Makefile.am (TESTS): Add tst-pam_mkargv.
* tests/tst-pam_mkargv.c (main): Test case for
_pam_mkargv.
* po/de.po: Update fuzzy translations.
Diffstat (limited to 'tests/tst-pam_mkargv.c')
-rw-r--r-- | tests/tst-pam_mkargv.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/tst-pam_mkargv.c b/tests/tst-pam_mkargv.c new file mode 100644 index 00000000..462875b8 --- /dev/null +++ b/tests/tst-pam_mkargv.c @@ -0,0 +1,52 @@ +/* + Copyright (C) Thorsten Kukuk <kukuk@suse.de> 2009 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation in version 2 of the License. +*/ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <string.h> + +#include "pam_misc.c" + +/* Simple program to see if _pam_mkargv() would succeed. */ +int main(void) +{ + char *argvstring = "user = XENDT\\userĪ± user=XENDT\\user1"; + const char *argvresult[] = {"user", "=", "XENDT\\userĪ±", + "user=XENDT\\user1"}; + int myargc; + char **myargv; + int argvlen; + int i; + + argvlen = _pam_mkargv(argvstring, &myargv, &myargc); + +#if 0 + printf ("argvlen=%i, argc=%i", argvlen, myargc); + for (i = 0; i < myargc; i++) { + printf(", argv[%d]=%s", i, myargv[i]); + } + printf ("\n"); +#endif + + if (argvlen != 333) + return 1; + + if (myargc != 4) + return 1; + + for (i = 0; i < 4; i++) + { + if (strcmp (myargv[i], argvresult[i]) != 0) + return 1; + } + + return 0; +} |