diff options
author | Ron Yorston <rmy@pobox.com> | 2015-05-18 14:38:08 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2015-05-18 14:38:08 +0100 |
commit | 4a9a7addbc23be8e7db385697678f53a9d0b96a1 (patch) | |
tree | eaab6e7b36fac13da1f3d25f167c62912652ab87 | |
parent | 10695d3d3472bb5ad7b9f5d9313f073fc67a8f1a (diff) | |
download | busybox-w32-4a9a7addbc23be8e7db385697678f53a9d0b96a1.tar.gz busybox-w32-4a9a7addbc23be8e7db385697678f53a9d0b96a1.tar.bz2 busybox-w32-4a9a7addbc23be8e7db385697678f53a9d0b96a1.zip |
mingw: provide fake getgroups and getgrouplist
This makes it possible to enable the id and groups applets,
though the results they return are worthless.
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | configs/mingw32_defconfig | 6 | ||||
-rw-r--r-- | include/mingw.h | 3 | ||||
-rw-r--r-- | win32/mingw.c | 22 |
4 files changed, 28 insertions, 4 deletions
@@ -18,3 +18,4 @@ Then just `make`. | |||
18 | - Don't do wild things with Windows drive or UNC notation. | 18 | - Don't do wild things with Windows drive or UNC notation. |
19 | - tar doesn't support seamless compression/decompression: use a pipeline to a compressor/decompressor. | 19 | - tar doesn't support seamless compression/decompression: use a pipeline to a compressor/decompressor. |
20 | - Wildcard expansion is disabled by default, though it can be turned on at compile time. This only affects command line arguments to the binary: the BusyBox shell has full support for wildcards. | 20 | - Wildcard expansion is disabled by default, though it can be turned on at compile time. This only affects command line arguments to the binary: the BusyBox shell has full support for wildcards. |
21 | - Handling of users, groups and permissions is totally bogus. The system only admits to knowing about the current user and always returns the same hardcoded uid, gid and permission values. | ||
diff --git a/configs/mingw32_defconfig b/configs/mingw32_defconfig index bb652f05f..6804752f2 100644 --- a/configs/mingw32_defconfig +++ b/configs/mingw32_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Busybox version: 1.24.0.git | 3 | # Busybox version: 1.24.0.git |
4 | # Mon May 18 10:01:53 2015 | 4 | # Mon May 18 14:31:53 2015 |
5 | # | 5 | # |
6 | CONFIG_HAVE_DOT_CONFIG=y | 6 | CONFIG_HAVE_DOT_CONFIG=y |
7 | # CONFIG_PLATFORM_POSIX is not set | 7 | # CONFIG_PLATFORM_POSIX is not set |
@@ -193,8 +193,8 @@ CONFIG_DD=y | |||
193 | CONFIG_FEATURE_DD_IBS_OBS=y | 193 | CONFIG_FEATURE_DD_IBS_OBS=y |
194 | CONFIG_FEATURE_DD_STATUS=y | 194 | CONFIG_FEATURE_DD_STATUS=y |
195 | # CONFIG_HOSTID is not set | 195 | # CONFIG_HOSTID is not set |
196 | # CONFIG_ID is not set | 196 | CONFIG_ID=y |
197 | # CONFIG_GROUPS is not set | 197 | CONFIG_GROUPS=y |
198 | CONFIG_SHUF=y | 198 | CONFIG_SHUF=y |
199 | CONFIG_TEST=y | 199 | CONFIG_TEST=y |
200 | CONFIG_FEATURE_TEST_64=y | 200 | CONFIG_FEATURE_TEST_64=y |
diff --git a/include/mingw.h b/include/mingw.h index f3b260f5a..84522f032 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -48,6 +48,7 @@ IMPL(getgrnam,struct group *,NULL,const char *name UNUSED_PARAM); | |||
48 | struct group *getgrgid(gid_t gid); | 48 | struct group *getgrgid(gid_t gid); |
49 | NOIMPL(initgroups,const char *group UNUSED_PARAM,gid_t gid UNUSED_PARAM); | 49 | NOIMPL(initgroups,const char *group UNUSED_PARAM,gid_t gid UNUSED_PARAM); |
50 | static inline void endgrent(void) {} | 50 | static inline void endgrent(void) {} |
51 | int getgrouplist(const char *user, gid_t group, gid_t *groups, int *ngroups); | ||
51 | 52 | ||
52 | /* | 53 | /* |
53 | * limits.h | 54 | * limits.h |
@@ -380,7 +381,7 @@ char *mingw_getcwd(char *pointer, int len); | |||
380 | 381 | ||
381 | 382 | ||
382 | IMPL(getgid,int,DEFAULT_GID,void); | 383 | IMPL(getgid,int,DEFAULT_GID,void); |
383 | NOIMPL(getgroups,int n UNUSED_PARAM,gid_t *groups UNUSED_PARAM); | 384 | int getgroups(int n, gid_t *groups); |
384 | IMPL(getppid,int,1,void); | 385 | IMPL(getppid,int,1,void); |
385 | IMPL(getegid,int,DEFAULT_GID,void); | 386 | IMPL(getegid,int,DEFAULT_GID,void); |
386 | IMPL(geteuid,int,DEFAULT_UID,void); | 387 | IMPL(geteuid,int,DEFAULT_UID,void); |
diff --git a/win32/mingw.c b/win32/mingw.c index 5847e0fa0..bb08647a6 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -648,6 +648,28 @@ struct group *getgrgid(gid_t gid UNUSED_PARAM) | |||
648 | return &g; | 648 | return &g; |
649 | } | 649 | } |
650 | 650 | ||
651 | int getgrouplist(const char *user, gid_t group, gid_t *groups, int *ngroups) | ||
652 | { | ||
653 | if ( *ngroups == 0 ) { | ||
654 | *ngroups = 1; | ||
655 | return -1; | ||
656 | } | ||
657 | |||
658 | *ngroups = 1; | ||
659 | groups[0] = DEFAULT_GID; | ||
660 | return 1; | ||
661 | } | ||
662 | |||
663 | int getgroups(int n, gid_t *groups) | ||
664 | { | ||
665 | if ( n == 0 ) { | ||
666 | return 1; | ||
667 | } | ||
668 | |||
669 | groups[0] = DEFAULT_GID; | ||
670 | return 1; | ||
671 | } | ||
672 | |||
651 | int getlogin_r(char *buf, size_t len) | 673 | int getlogin_r(char *buf, size_t len) |
652 | { | 674 | { |
653 | char *name; | 675 | char *name; |