Hi,
the attached patch fixes all warnings that occurred on my unstable
system. This also includes a fix for the setgroups() flaw in chpst.
Regards,
Tino
diff -ru runit-1.3.3/admin/runit-1.3.3/src/chkshsgr.c
src/runit-1.3.3/admin/runit-1.3.3/src/chkshsgr.c
--- runit-1.3.3/admin/runit-1.3.3/src/chkshsgr.c 2006-01-02
21:39:50.000000000 +0100
+++ src/runit-1.3.3/admin/runit-1.3.3/src/chkshsgr.c 2006-03-12
22:41:00.000000000 +0100
@@ -1,10 +1,12 @@
/* Public domain. */
+#include <sys/types.h>
#include <unistd.h>
+#include <grp.h>
int main()
{
- short x[4];
+ gid_t x[4];
x[0] = x[1] = 0;
if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1);
diff -ru runit-1.3.3/admin/runit-1.3.3/src/chpst.c
src/runit-1.3.3/admin/runit-1.3.3/src/chpst.c
--- runit-1.3.3/admin/runit-1.3.3/src/chpst.c 2006-01-02 21:39:50.000000000
+0100
+++ src/runit-1.3.3/admin/runit-1.3.3/src/chpst.c 2006-03-12
22:41:00.000000000 +0100
@@ -3,6 +3,7 @@
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
+#include <grp.h>
#include "sgetopt.h"
#include "error.h"
#include "strerr.h"
diff -ru runit-1.3.3/admin/runit-1.3.3/src/pathexec_run.c
src/runit-1.3.3/admin/runit-1.3.3/src/pathexec_run.c
--- runit-1.3.3/admin/runit-1.3.3/src/pathexec_run.c 2006-01-02
21:39:50.000000000 +0100
+++ src/runit-1.3.3/admin/runit-1.3.3/src/pathexec_run.c 2006-03-12
22:41:00.000000000 +0100
@@ -1,5 +1,6 @@
/* Public domain. */
+#include <unistd.h>
#include "error.h"
#include "stralloc.h"
#include "str.h"
@@ -15,7 +16,7 @@
int savederrno;
if (file[str_chr(file,'/')]) {
- execve(file,argv,envp);
+ execve(file,(char * const *)argv,(char * const *)envp);
return;
}
@@ -32,7 +33,7 @@
if (!stralloc_cats(&tmp,file)) return;
if (!stralloc_0(&tmp)) return;
- execve(tmp.s,argv,envp);
+ execve(tmp.s,(char * const *)argv,(char * const *)envp);
if (errno != error_noent) {
savederrno = errno;
if ((errno != error_acces) && (errno != error_perm) && (errno !=
error_isdir)) return;
diff -ru runit-1.3.3/admin/runit-1.3.3/src/prot.c
src/runit-1.3.3/admin/runit-1.3.3/src/prot.c
--- runit-1.3.3/admin/runit-1.3.3/src/prot.c 2006-01-02 21:39:50.000000000
+0100
+++ src/runit-1.3.3/admin/runit-1.3.3/src/prot.c 2006-03-12
22:41:00.000000000 +0100
@@ -1,12 +1,15 @@
/* Public domain. */
+#include <sys/types.h>
+#include <unistd.h>
+#include <grp.h>
#include "hasshsgr.h"
#include "prot.h"
-int prot_gid(int gid)
+int prot_gid(gid_t gid)
{
#ifdef HASSHORTSETGROUPS
- short x[2];
+ gid_t x[2];
x[0] = gid; x[1] = 73; /* catch errors */
if (setgroups(1,x) == -1) return -1;
#else
@@ -15,7 +18,7 @@
return setgid(gid); /* _should_ be redundant, but on some systems it isn't */
}
-int prot_uid(int uid)
+int prot_uid(uid_t uid)
{
return setuid(uid);
}
diff -ru runit-1.3.3/admin/runit-1.3.3/src/prot.h
src/runit-1.3.3/admin/runit-1.3.3/src/prot.h
--- runit-1.3.3/admin/runit-1.3.3/src/prot.h 2006-01-02 21:39:50.000000000
+0100
+++ src/runit-1.3.3/admin/runit-1.3.3/src/prot.h 2006-03-12
22:41:00.000000000 +0100
@@ -3,7 +3,7 @@
#ifndef PROT_H
#define PROT_H
-extern int prot_gid(int);
-extern int prot_uid(int);
+extern int prot_gid(gid_t);
+extern int prot_uid(uid_t);
#endif
diff -ru runit-1.3.3/admin/runit-1.3.3/src/seek_set.c
src/runit-1.3.3/admin/runit-1.3.3/src/seek_set.c
--- runit-1.3.3/admin/runit-1.3.3/src/seek_set.c 2006-01-02
21:39:50.000000000 +0100
+++ src/runit-1.3.3/admin/runit-1.3.3/src/seek_set.c 2006-03-12
22:41:00.000000000 +0100
@@ -1,6 +1,7 @@
/* Public domain. */
#include <sys/types.h>
+#include <unistd.h>
#include "seek.h"
#define SET 0 /* sigh */
diff -ru runit-1.3.3/admin/runit-1.3.3/src/uidgid.h
src/runit-1.3.3/admin/runit-1.3.3/src/uidgid.h
--- runit-1.3.3/admin/runit-1.3.3/src/uidgid.h 2006-01-02 21:39:51.000000000
+0100
+++ src/runit-1.3.3/admin/runit-1.3.3/src/uidgid.h 2006-03-12
22:42:34.000000000 +0100
@@ -1,10 +1,12 @@
#ifndef UIDGID_H
#define UIDGID_H
+#include <sys/types.h>
+
struct uidgid {
- int uid;
- int gid[61];
- int gids;
+ uid_t uid;
+ gid_t gid[61];
+ size_t gids;
};
extern unsigned int uidgid_get(struct uidgid *, char *, unsigned int);