homectl: don't use password cache if we operate on other user
This commit is contained in:
@@ -1072,3 +1072,16 @@ int fgetsgent_sane(FILE *stream, struct sgrp **sg) {
|
||||
return !!s;
|
||||
}
|
||||
#endif
|
||||
|
||||
int is_this_me(const char *username) {
|
||||
uid_t uid;
|
||||
int r;
|
||||
|
||||
/* Checks if the specified username is our current one. Passed string might be a UID or a user name. */
|
||||
|
||||
r = get_user_creds(&username, &uid, NULL, NULL, NULL, USER_CREDS_ALLOW_MISSING);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return uid == getuid();
|
||||
}
|
||||
|
||||
@@ -109,3 +109,5 @@ int putsgent_sane(const struct sgrp *sg, FILE *stream);
|
||||
#endif
|
||||
|
||||
bool is_nologin_shell(const char *shell);
|
||||
|
||||
int is_this_me(const char *username);
|
||||
|
||||
Reference in New Issue
Block a user