From 66cb44437a5453e0b5eeffa20cf7c5b42f721279 Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Wed, 6 Dec 2023 19:54:42 +0100 Subject: libpam: remove format argument for _pam_tokenize It is always the same format. Signed-off-by: Tobias Stoeckmann --- libpam/pam_misc.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'libpam/pam_misc.c') diff --git a/libpam/pam_misc.c b/libpam/pam_misc.c index 8cf2214e..88702fcc 100644 --- a/libpam/pam_misc.c +++ b/libpam/pam_misc.c @@ -45,13 +45,14 @@ #include #include -char *_pam_tokenize(char *from, const char *format, char **next) +char *_pam_tokenize(char *from, char **next) /* - * this function is a variant of the standard strtok, it differs in that - * it takes an additional argument and doesn't nul terminate tokens until + * this function is a variant of the standard strtok_r, it differs in that + * it uses a fixed set of delimiters and doesn't nul terminate tokens until * they are actually reached. */ { + const char *format = " \n\t"; char table[256], *end; int i; @@ -71,11 +72,9 @@ char *_pam_tokenize(char *from, const char *format, char **next) if (*from == '[') { /* * special case, "[...]" is considered to be a single - * object. Note, however, if one of the format[] chars is - * '[' this single string will not be read correctly. - * Note, any '[' inside the outer "[...]" pair will survive. - * Note, the first ']' will terminate this string, but - * that "\]" will get compressed into "]". That is: + * object. Note, any '[' inside the outer "[...]" pair will + * survive. Note, the first ']' will terminate this string, + * but that "\]" will get compressed into "]". That is: * * "[..[..\]..]..." --> "..[..].." */ @@ -198,7 +197,7 @@ int _pam_mkargv(const char *s, char ***argv, int *argc) argvbufp = (char *) argvbuf + (l * sizeof(char *)); D(("[%s]",sbuf)); - while ((sbuf = _pam_tokenize(sbuf, " \n\t", &tmp))) { + while ((sbuf = _pam_tokenize(sbuf, &tmp))) { D(("arg #%d",++count)); D(("->[%s]",sbuf)); strcpy(argvbufp, sbuf); -- cgit v1.2.3