mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-08-08 09:21:48 +08:00
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:
+1
-1
@@ -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',
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user