diff options
author | Ron Yorston <rmy@pobox.com> | 2019-03-10 09:58:13 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-03-10 13:04:55 +0000 |
commit | b04bbc0109046ee69806a472fd7e44313c646687 (patch) | |
tree | 6e7a1985aecdbee605ae58ce7cc342c5d4e23027 /include | |
parent | 399b1dd641c16113c3340933a9b1ab1793a13d8a (diff) | |
download | busybox-w32-b04bbc0109046ee69806a472fd7e44313c646687.tar.gz busybox-w32-b04bbc0109046ee69806a472fd7e44313c646687.tar.bz2 busybox-w32-b04bbc0109046ee69806a472fd7e44313c646687.zip |
win32: changes to user ids
Formalise the use of 0 as the uid of a process running with elevated
privileges:
- Rewrite getuid(2) to return DEFAULT_UID by default and 0 if the
process has elevated privileges.
- geteuid(2) and the corresponding functions for groups are aliases
for getuid(2).
- Change root's home directory to be whatever GetSystemDirectory()
returns, probably C:/Windows/System32 in most cases.
- Remove the special handling of geteuid(2) in the line editing code.
With these changes the shell started by 'su' is a lot more like a
*nix root shell.
Diffstat (limited to 'include')
-rw-r--r-- | include/mingw.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/include/mingw.h b/include/mingw.h index ead07ae82..7aa2d5cc9 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -9,7 +9,7 @@ typedef int gid_t; | |||
9 | typedef int uid_t; | 9 | typedef int uid_t; |
10 | 10 | ||
11 | #define DEFAULT_UID 4095 | 11 | #define DEFAULT_UID 4095 |
12 | #define DEFAULT_GID 4095 | 12 | #define DEFAULT_GID DEFAULT_UID |
13 | 13 | ||
14 | /* | 14 | /* |
15 | * arpa/inet.h | 15 | * arpa/inet.h |
@@ -388,13 +388,13 @@ char *mingw_getcwd(char *pointer, int len); | |||
388 | off_t mingw_lseek(int fd, off_t offset, int whence); | 388 | off_t mingw_lseek(int fd, off_t offset, int whence); |
389 | 389 | ||
390 | 390 | ||
391 | IMPL(getgid,int,DEFAULT_GID,void); | 391 | int getuid(void); |
392 | #define getgid getuid | ||
393 | #define geteuid getuid | ||
394 | #define getegid getuid | ||
392 | int getgroups(int n, gid_t *groups); | 395 | int getgroups(int n, gid_t *groups); |
393 | IMPL(getppid,int,1,void); | 396 | IMPL(getppid,int,1,void); |
394 | IMPL(getegid,int,DEFAULT_GID,void); | ||
395 | IMPL(geteuid,int,DEFAULT_UID,void); | ||
396 | NOIMPL(getsid,pid_t pid UNUSED_PARAM); | 397 | NOIMPL(getsid,pid_t pid UNUSED_PARAM); |
397 | IMPL(getuid,int,DEFAULT_UID,void); | ||
398 | int getlogin_r(char *buf, size_t len); | 398 | int getlogin_r(char *buf, size_t len); |
399 | int fcntl(int fd, int cmd, ...); | 399 | int fcntl(int fd, int cmd, ...); |
400 | int fsync(int fd); | 400 | int fsync(int fd); |
@@ -521,4 +521,3 @@ ULONGLONG CompatGetTickCount64(void); | |||
521 | ssize_t get_random_bytes(void *buf, ssize_t count); | 521 | ssize_t get_random_bytes(void *buf, ssize_t count); |
522 | int enumerate_links(const char *file, char *name); | 522 | int enumerate_links(const char *file, char *name); |
523 | void hide_console(void); | 523 | void hide_console(void); |
524 | int is_admin(void); | ||