aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2015-05-18 14:38:08 +0100
committerRon Yorston <rmy@pobox.com>2015-05-18 14:38:08 +0100
commit4a9a7addbc23be8e7db385697678f53a9d0b96a1 (patch)
treeeaab6e7b36fac13da1f3d25f167c62912652ab87
parent10695d3d3472bb5ad7b9f5d9313f073fc67a8f1a (diff)
downloadbusybox-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.md1
-rw-r--r--configs/mingw32_defconfig6
-rw-r--r--include/mingw.h3
-rw-r--r--win32/mingw.c22
4 files changed, 28 insertions, 4 deletions
diff --git a/README.md b/README.md
index 77e6bad73..d4140487c 100644
--- a/README.md
+++ b/README.md
@@ -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#
6CONFIG_HAVE_DOT_CONFIG=y 6CONFIG_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
193CONFIG_FEATURE_DD_IBS_OBS=y 193CONFIG_FEATURE_DD_IBS_OBS=y
194CONFIG_FEATURE_DD_STATUS=y 194CONFIG_FEATURE_DD_STATUS=y
195# CONFIG_HOSTID is not set 195# CONFIG_HOSTID is not set
196# CONFIG_ID is not set 196CONFIG_ID=y
197# CONFIG_GROUPS is not set 197CONFIG_GROUPS=y
198CONFIG_SHUF=y 198CONFIG_SHUF=y
199CONFIG_TEST=y 199CONFIG_TEST=y
200CONFIG_FEATURE_TEST_64=y 200CONFIG_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);
48struct group *getgrgid(gid_t gid); 48struct group *getgrgid(gid_t gid);
49NOIMPL(initgroups,const char *group UNUSED_PARAM,gid_t gid UNUSED_PARAM); 49NOIMPL(initgroups,const char *group UNUSED_PARAM,gid_t gid UNUSED_PARAM);
50static inline void endgrent(void) {} 50static inline void endgrent(void) {}
51int 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
382IMPL(getgid,int,DEFAULT_GID,void); 383IMPL(getgid,int,DEFAULT_GID,void);
383NOIMPL(getgroups,int n UNUSED_PARAM,gid_t *groups UNUSED_PARAM); 384int getgroups(int n, gid_t *groups);
384IMPL(getppid,int,1,void); 385IMPL(getppid,int,1,void);
385IMPL(getegid,int,DEFAULT_GID,void); 386IMPL(getegid,int,DEFAULT_GID,void);
386IMPL(geteuid,int,DEFAULT_UID,void); 387IMPL(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
651int 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
663int 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
651int getlogin_r(char *buf, size_t len) 673int getlogin_r(char *buf, size_t len)
652{ 674{
653 char *name; 675 char *name;