summaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authorjylefort <jylefort@df743ca5-7f9a-e211-a948-0013205c9059>2006-05-02 07:57:57 +0800
committerjylefort <jylefort@df743ca5-7f9a-e211-a948-0013205c9059>2006-05-02 07:57:57 +0800
commite3a13cae18c79c6511db14223d53cf18ee10177f (patch)
tree211b18f2c04ca96689d17bb9ca57cdbf8288c4dd /sysutils
parent8becba9d441d237ee90f306a5564ac95398dc721 (diff)
downloadmarcuscom-ports-e3a13cae18c79c6511db14223d53cf18ee10177f.tar
marcuscom-ports-e3a13cae18c79c6511db14223d53cf18ee10177f.tar.gz
marcuscom-ports-e3a13cae18c79c6511db14223d53cf18ee10177f.tar.bz2
marcuscom-ports-e3a13cae18c79c6511db14223d53cf18ee10177f.tar.lz
marcuscom-ports-e3a13cae18c79c6511db14223d53cf18ee10177f.tar.xz
marcuscom-ports-e3a13cae18c79c6511db14223d53cf18ee10177f.tar.zst
marcuscom-ports-e3a13cae18c79c6511db14223d53cf18ee10177f.zip
Fix some crashes.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@6191 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/policykit/Makefile4
-rw-r--r--sysutils/policykit/files/patch-polkitd_policy.c118
2 files changed, 120 insertions, 2 deletions
diff --git a/sysutils/policykit/Makefile b/sysutils/policykit/Makefile
index 1c623c1f3..42b8ac566 100644
--- a/sysutils/policykit/Makefile
+++ b/sysutils/policykit/Makefile
@@ -3,12 +3,12 @@
# Whom: Joe Marcus Clarke <marcus@FreeBSD.org>
#
# $FreeBSD$
-# $MCom: ports/sysutils/policykit/Makefile,v 1.4 2006/05/01 07:42:38 marcus Exp $
+# $MCom: ports/sysutils/policykit/Makefile,v 1.5 2006/05/01 07:49:05 marcus Exp $
#
PORTNAME= policykit
PORTVERSION= 0.1
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= sysutils gnome
MASTER_SITES= http://www.marcuscom.com/downloads/
DISTNAME= PolicyKit-${PORTVERSION}
diff --git a/sysutils/policykit/files/patch-polkitd_policy.c b/sysutils/policykit/files/patch-polkitd_policy.c
new file mode 100644
index 000000000..c633366a2
--- /dev/null
+++ b/sysutils/policykit/files/patch-polkitd_policy.c
@@ -0,0 +1,118 @@
+--- polkitd/policy.c.orig Tue Mar 14 07:14:33 2006
++++ polkitd/policy.c Tue May 2 01:53:06 2006
+@@ -537,13 +537,15 @@
+ int rc;
+ char *res;
+ char *buf = NULL;
+- unsigned int bufsize;
++ long bufsize;
+ struct passwd pwd;
+ struct passwd *pwdp;
+
+ res = NULL;
+
+ bufsize = sysconf (_SC_GETPW_R_SIZE_MAX);
++ if (bufsize < 0)
++ bufsize = 1024;
+ buf = g_new0 (char, bufsize);
+
+ rc = getpwuid_r (uid, &pwd, buf, bufsize, &pwdp);
+@@ -567,13 +569,15 @@
+ int rc;
+ char *res;
+ char *buf = NULL;
+- unsigned int bufsize;
++ long bufsize;
+ struct group gbuf;
+ struct group *gbufp;
+
+ res = NULL;
+
+ bufsize = sysconf (_SC_GETGR_R_SIZE_MAX);
++ if (bufsize < 0)
++ bufsize = 1024;
+ buf = g_new0 (char, bufsize);
+
+ rc = getgrgid_r (gid, &gbuf, buf, bufsize, &gbufp);
+@@ -597,13 +601,15 @@
+ int rc;
+ uid_t res;
+ char *buf = NULL;
+- unsigned int bufsize;
++ long bufsize;
+ struct passwd pwd;
+ struct passwd *pwdp;
+
+ res = (uid_t) -1;
+
+ bufsize = sysconf (_SC_GETPW_R_SIZE_MAX);
++ if (bufsize < 0)
++ bufsize = 1024;
+ buf = g_new0 (char, bufsize);
+
+ rc = getpwnam_r (username, &pwd, buf, bufsize, &pwdp);
+@@ -627,13 +633,15 @@
+ int rc;
+ gid_t res;
+ char *buf = NULL;
+- unsigned int bufsize;
++ long bufsize;
+ struct group gbuf;
+ struct group *gbufp;
+
+ res = (gid_t) -1;
+
+ bufsize = sysconf (_SC_GETGR_R_SIZE_MAX);
++ if (bufsize < 0)
++ bufsize = 1024;
+ buf = g_new0 (char, bufsize);
+
+ rc = getgrnam_r (groupname, &gbuf, buf, bufsize, &gbufp);
+@@ -649,6 +657,23 @@
+ return res;
+ }
+
++static int
++getgrouplist_ala_linux (const char *name,
++ gid_t basegid,
++ gid_t *groups,
++ int *ngroups)
++{
++ if (groups)
++ return getgrouplist (name, basegid, groups, ngroups);
++ else {
++ for (*ngroups = 1;; (*ngroups)++) {
++ gid_t _groups[*ngroups];
++ if (getgrouplist (name, basegid, _groups, ngroups) != -1)
++ return 0;
++ }
++ }
++}
++
+ PolicyResult
+ policy_get_allowed_resources_for_policy_for_uid (uid_t uid,
+ const char *policy,
+@@ -665,9 +690,9 @@
+ if ((username = policy_util_uid_to_name (uid, &default_gid)) == NULL)
+ goto out;
+
+- if (getgrouplist(username, default_gid, NULL, &num_groups) < 0) {
++ if (getgrouplist_ala_linux(username, default_gid, NULL, &num_groups) < 0) {
+ groups = (gid_t *) g_new0 (gid_t, num_groups);
+- if (getgrouplist(username, default_gid, groups, &num_groups) < 0) {
++ if (getgrouplist_ala_linux(username, default_gid, groups, &num_groups) < 0) {
+ g_warning ("getgrouplist() failed");
+ goto out;
+ }
+@@ -702,9 +727,9 @@
+ if ((username = policy_util_uid_to_name (uid, &default_gid)) == NULL)
+ goto out;
+
+- if (getgrouplist(username, default_gid, NULL, &num_groups) < 0) {
++ if (getgrouplist_ala_linux(username, default_gid, NULL, &num_groups) < 0) {
+ groups = (gid_t *) g_new0 (gid_t, num_groups);
+- if (getgrouplist(username, default_gid, groups, &num_groups) < 0) {
++ if (getgrouplist_ala_linux(username, default_gid, groups, &num_groups) < 0) {
+ g_warning ("getgrouplist() failed");
+ goto out;
+ }