summaryrefslogtreecommitdiff
path: root/libacl
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2003-07-29 01:55:43 +0000
committerNathan Scott <nathans@sgi.com>2003-07-29 01:55:43 +0000
commit3dc3290a60c56bd1d1a14a17ac93362ab1773843 (patch)
treed2114d01961a828e0d39679583cb6425ab289746 /libacl
parent406dcfedd09a56b14e58cbcf0094a75f8d5b34ac (diff)
downloadacl-3dc3290a60c56bd1d1a14a17ac93362ab1773843.tar.gz
ACL update from AG - libmisc routines, numerous test updates
Diffstat (limited to 'libacl')
-rw-r--r--libacl/Makefile3
-rw-r--r--libacl/__acl_to_any_text.c7
-rw-r--r--libacl/acl_from_text.c21
3 files changed, 16 insertions, 15 deletions
diff --git a/libacl/Makefile b/libacl/Makefile
index 908a39b..53510e1 100644
--- a/libacl/Makefile
+++ b/libacl/Makefile
@@ -37,7 +37,8 @@ LTLDFLAGS += -Wl,--version-script,$(TOPDIR)/exports
include $(TOPDIR)/include/builddefs
LTLIBRARY = libacl.la
-LTLIBS = -lattr
+LTLIBS = -lattr $(LIBMISC)
+LTDEPENDENCIES = $(LIBMISC)
LT_CURRENT = 2
LT_REVISION = 0
LT_AGE = 1
diff --git a/libacl/__acl_to_any_text.c b/libacl/__acl_to_any_text.c
index 3a3bdb1..6850f3f 100644
--- a/libacl/__acl_to_any_text.c
+++ b/libacl/__acl_to_any_text.c
@@ -26,6 +26,7 @@
#include <grp.h>
#include <acl/libacl.h>
#include "libacl.h"
+#include "misc.h"
static ssize_t acl_entry_to_any_str(const acl_entry_t entry_d, char *text_p,
ssize_t size, const acl_entry_t mask_d,
@@ -158,7 +159,8 @@ acl_entry_to_any_str(const acl_entry_t entry_d, char *text_p, ssize_t size,
if (options & TEXT_NUMERIC_IDS)
str = NULL;
else
- str = user_name(entry_obj_p->eid.qid);
+ str = quote(user_name(
+ entry_obj_p->eid.qid));
if (str != NULL) {
strncpy(text_p, str, size);
ADVANCE(strlen(str));
@@ -180,7 +182,8 @@ acl_entry_to_any_str(const acl_entry_t entry_d, char *text_p, ssize_t size,
if (options & TEXT_NUMERIC_IDS)
str = NULL;
else
- str = group_name(entry_obj_p->eid.qid);
+ str = quote(group_name(
+ entry_obj_p->eid.qid));
if (str != NULL) {
strncpy(text_p, str, size);
ADVANCE(strlen(str));
diff --git a/libacl/acl_from_text.c b/libacl/acl_from_text.c
index dd36af0..db5ba81 100644
--- a/libacl/acl_from_text.c
+++ b/libacl/acl_from_text.c
@@ -23,6 +23,7 @@
#include <pwd.h>
#include <grp.h>
#include "libacl.h"
+#include "misc.h"
#define SKIP_WS(x) do { \
@@ -150,16 +151,13 @@ get_uid(const char *token, uid_t *uid_p)
struct passwd *passwd;
if (get_id(token, uid_p) == 0)
- goto accept;
+ return 0;
passwd = getpwnam(token);
if (passwd) {
*uid_p = passwd->pw_uid;
- goto accept;
+ return 0;
}
return -1;
-
-accept:
- return 0;
}
@@ -169,16 +167,13 @@ get_gid(const char *token, gid_t *gid_p)
struct group *group;
if (get_id(token, (uid_t *)gid_p) == 0)
- goto accept;
+ return 0;
group = getgrnam(token);
if (group) {
*gid_p = group->gr_gid;
- goto accept;
+ return 0;
}
return -1;
-
-accept:
- return 0;
}
@@ -211,7 +206,8 @@ parse_acl_entry(const char **text_p, acl_t *acl_p)
str = get_token(text_p);
if (str) {
entry_obj.etag = ACL_USER;
- error = get_uid(str, &entry_obj.eid.qid);
+ error = get_uid(unquote(str),
+ &entry_obj.eid.qid);
free(str);
if (error) {
*text_p = backup;
@@ -229,7 +225,8 @@ parse_acl_entry(const char **text_p, acl_t *acl_p)
str = get_token(text_p);
if (str) {
entry_obj.etag = ACL_GROUP;
- error = get_gid(str, &entry_obj.eid.qid);
+ error = get_gid(unquote(str),
+ &entry_obj.eid.qid);
free(str);
if (error) {
*text_p = backup;