strsep: removed conditional code for strsep

strsep() was used conditionally in plain authentication with fallback
code, whereas radius code used it unconditionally. Rely on strsep()
unconditionally to simplify the code.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
This commit is contained in:
Nikos Mavrogiannopoulos
2026-04-06 21:02:06 +02:00
parent 85b4d19f0a
commit 2e81af318e
2 changed files with 1 additions and 30 deletions
+1 -1
View File
@@ -308,7 +308,7 @@ have_scm_timestamping = cc.has_type('struct scm_timestamping',
check_funcs = [
'setproctitle', 'vasprintf', 'clock_gettime', 'isatty',
'pselect', 'ppoll', 'getpeereid', 'sigaltstack',
'strlcpy', 'posix_memalign', 'malloc_trim', 'strsep',
'strlcpy', 'posix_memalign', 'malloc_trim',
'memset', 'malloc', 'free',
'makecontext', 'getcontext', 'swapcontext',
'sigaction', 'longjmp', 'setjmp',
-29
View File
@@ -175,7 +175,6 @@ static int read_auth_pass(struct plain_ctx_st *pctx)
ll--;
line[ll] = 0;
}
#ifdef HAVE_STRSEP
sp = line;
p = strsep(&sp, ":");
@@ -195,27 +194,6 @@ static int read_auth_pass(struct plain_ctx_st *pctx)
}
}
}
#else
p = strtok_r(line, ":", &sp);
if (p != NULL && strcmp(pctx->username, p) == 0) {
p = strtok_r(NULL, ":", &sp);
if (p != NULL) {
break_group_list(pctx, p, pctx->groupnames,
&pctx->groupnames_size);
p = strtok_r(NULL, ":", &sp);
if (p != NULL) {
strlcpy(pctx->cpass, p,
sizeof(pctx->cpass));
pctx->unknown_user = 0;
ret = 0;
goto exit;
}
}
}
#endif
}
/* always succeed */
@@ -442,18 +420,11 @@ static void plain_group_list(void *pool, void *additional, char ***groupname,
line[ll] = 0;
}
#ifdef HAVE_STRSEP
sp = line;
p = strsep(&sp, ":");
if (p != NULL) {
p = strsep(&sp, ":");
#else
p = strtok_r(line, ":", &sp);
if (p != NULL) {
p = strtok_r(NULL, ":", &sp);
#endif
if (p != NULL) {
break_group_list(pool, p, tgroup, &tgroup_size);