mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 09:57:41 +00:00
parent
8dd2967766
commit
8faf432499
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -47,10 +48,13 @@ sudoers_sethost(struct sudoers_context *ctx, const char *host,
|
|||||||
ctx->user.host = NULL;
|
ctx->user.host = NULL;
|
||||||
ctx->user.shost = NULL;
|
ctx->user.shost = NULL;
|
||||||
|
|
||||||
if (host == NULL)
|
if (host == NULL) {
|
||||||
ctx->user.host = sudo_gethostname();
|
ctx->user.host = sudo_gethostname();
|
||||||
else
|
if (ctx->user.host == NULL && errno != ENOMEM)
|
||||||
|
ctx->user.host = strdup("localhost");
|
||||||
|
} else {
|
||||||
ctx->user.host = strdup(host);
|
ctx->user.host = strdup(host);
|
||||||
|
}
|
||||||
if (ctx->user.host == NULL)
|
if (ctx->user.host == NULL)
|
||||||
goto oom;
|
goto oom;
|
||||||
if ((cp = strchr(ctx->user.host, '.')) != NULL) {
|
if ((cp = strchr(ctx->user.host, '.')) != NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user