krb5: support %{euid} path expansion token
This commit is contained in:
@@ -299,6 +299,14 @@ _expand_userid(krb5_context context, PTYPE param, const char *postfix, char **st
|
||||
return 0;
|
||||
}
|
||||
|
||||
static krb5_error_code
|
||||
_expand_euid(krb5_context context, PTYPE param, const char *postfix, char **str)
|
||||
{
|
||||
int ret = asprintf(str, "%ld", (unsigned long)geteuid());
|
||||
if (ret < 0 || *str == NULL)
|
||||
return krb5_enomem(context);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
@@ -366,6 +374,7 @@ static const struct {
|
||||
{"BINDIR", FTYPE_SPECIAL, 0, BINDIR, _expand_path},
|
||||
{"LIBEXEC", FTYPE_SPECIAL, 0, LIBEXECDIR, _expand_path},
|
||||
{"SBINDIR", FTYPE_SPECIAL, 0, SBINDIR, _expand_path},
|
||||
{"euid", SPECIAL(_expand_euid)},
|
||||
#endif
|
||||
{"TEMP", SPECIAL(_expand_temp_folder)},
|
||||
{"USERID", SPECIAL(_expand_userid)},
|
||||
|
@@ -294,6 +294,7 @@ struct {
|
||||
{ "foo", 0, "foo" },
|
||||
{ "foo%}", 0, "foo%}" },
|
||||
{ "%{uid}", 0, NULL },
|
||||
{ "%{euid}", 0, NULL },
|
||||
{ "foo%{null}", 0, "foo" },
|
||||
{ "foo%{null}bar", 0, "foobar" },
|
||||
{ "%{", 1, NULL },
|
||||
|
Reference in New Issue
Block a user