acl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH acl] libmisc: rename internal uid/gid symbols with __acl_ prefix


From: Mike Frysinger
Subject: [PATCH acl] libmisc: rename internal uid/gid symbols with __acl_ prefix
Date: Wed, 31 Jan 2024 23:55:40 -0500

While shared libs take care of hiding these symbols from the exported
list, they can still show up in static linking and cause collisions.
The codebase is using __acl_ as a prefix for other internal symbols,
so rename these to match.
---
 include/misc.h           |  5 ++---
 libacl/acl_from_text.c   |  8 ++++----
 libmisc/uid_gid_lookup.c |  6 +++---
 tools/parse.c            | 10 ++++++----
 4 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/include/misc.h b/include/misc.h
index 52cfec4fa082..4440053e6957 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -35,9 +35,8 @@ hidden char *__acl_unquote(char *str);
 
 hidden char *__acl_next_line(FILE *file);
 
-hidden int get_id(const char *token, id_t *id_p);
-hidden int get_uid(const char *token, uid_t *uid_p);
-hidden int get_gid(const char *token, gid_t *gid_p);
+hidden int __acl_get_uid(const char *token, uid_t *uid_p);
+hidden int __acl_get_gid(const char *token, gid_t *gid_p);
 
 #ifdef ENABLE_NLS
 # include <libintl.h>
diff --git a/libacl/acl_from_text.c b/libacl/acl_from_text.c
index 3f96146de076..1d9de5d577ea 100644
--- a/libacl/acl_from_text.c
+++ b/libacl/acl_from_text.c
@@ -154,8 +154,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(__acl_unquote(str),
-                                               &entry_obj.eid.qid);
+                               error = __acl_get_uid(__acl_unquote(str),
+                                                     &entry_obj.eid.qid);
                                free(str);
                                if (error) {
                                        *text_p = backup;
@@ -173,8 +173,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(__acl_unquote(str),
-                                               &entry_obj.eid.qid);
+                               error = __acl_get_gid(__acl_unquote(str),
+                                                     &entry_obj.eid.qid);
                                free(str);
                                if (error) {
                                        *text_p = backup;
diff --git a/libmisc/uid_gid_lookup.c b/libmisc/uid_gid_lookup.c
index 6746afdab0d5..a4f21f6ae03b 100644
--- a/libmisc/uid_gid_lookup.c
+++ b/libmisc/uid_gid_lookup.c
@@ -28,7 +28,7 @@
 #include "libacl.h"
 #include "misc.h"
 
-int
+static int
 get_id(const char *token, id_t *id_p)
 {
        char *ep;
@@ -70,7 +70,7 @@ grow_buffer(char **buffer, size_t *bufsize, int type)
 }
 
 int
-get_uid(const char *token, uid_t *uid_p)
+__acl_get_uid(const char *token, uid_t *uid_p)
 {
        struct passwd passwd, *result = NULL;
        char *buffer = NULL;
@@ -98,7 +98,7 @@ get_uid(const char *token, uid_t *uid_p)
 
 
 int
-get_gid(const char *token, gid_t *gid_p)
+__acl_get_gid(const char *token, gid_t *gid_p)
 {
        struct group group, *result = NULL;
        char *buffer = NULL;
diff --git a/tools/parse.c b/tools/parse.c
index 96e8ffe47b42..c92b00bd46f6 100644
--- a/tools/parse.c
+++ b/tools/parse.c
@@ -162,7 +162,8 @@ user_entry:
                        str = get_token(text_p);
                        if (str) {
                                cmd->c_tag = ACL_USER;
-                               error = get_uid(__acl_unquote(str), &cmd->c_id);
+                               error = __acl_get_uid(__acl_unquote(str),
+                                                     &cmd->c_id);
                                free(str);
                                if (error) {
                                        *text_p = backup;
@@ -181,7 +182,8 @@ user_entry:
                        str = get_token(text_p);
                        if (str) {
                                cmd->c_tag = ACL_GROUP;
-                               error = get_gid(__acl_unquote(str), &cmd->c_id);
+                               error = __acl_get_gid(__acl_unquote(str),
+                                                     &cmd->c_id);
                                free(str);
                                if (error) {
                                        *text_p = backup;
@@ -411,7 +413,7 @@ read_acl_comments(
                        if (uid_p) {
                                if (*uid_p != ACL_UNDEFINED_ID)
                                        goto fail;
-                               if (get_uid(__acl_unquote(cp), uid_p) != 0)
+                               if (__acl_get_uid(__acl_unquote(cp), uid_p) != 
0)
                                        continue;
                        }
                } else if (strncmp(cp, "group:", 6) == 0) {
@@ -421,7 +423,7 @@ read_acl_comments(
                        if (gid_p) {
                                if (*gid_p != ACL_UNDEFINED_ID)
                                        goto fail;
-                               if (get_gid(__acl_unquote(cp), gid_p) != 0)
+                               if (__acl_get_gid(__acl_unquote(cp), gid_p) != 
0)
                                        continue;
                        }
                } else if (strncmp(cp, "flags:", 6) == 0) {
-- 
2.43.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]