summaryrefslogtreecommitdiff
path: root/server/access.c
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@1ts.org>2010-08-24 07:08:35 +0000
committerGravatar Karl Ramm <kcr@1ts.org>2010-08-24 07:08:35 +0000
commitd5f3280d24efcdc24c861c26a4c32e967e16eee2 (patch)
tree679320a093aeab61eb9e0d559cf7f42084de6e33 /server/access.c
parent347c45bf947318521ff741052746a5bfc3dff07b (diff)
Don't use MAXPATHLEN anymore.
Some systems don't have it, having shaken off the shackles of fixed lengths. Unfortunately rewriting these things "right" in a fashion portable to unembraced-and-extended C libraries is aggravating. So do it wrong until we decide to bite the bullet and demand glib.
Diffstat (limited to 'server/access.c')
-rw-r--r--server/access.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/server/access.c b/server/access.c
index 9285b32..8aa2060 100644
--- a/server/access.c
+++ b/server/access.c
@@ -61,7 +61,7 @@ access_check(char *sender,
Acl *acl,
Access accesstype)
{
- char buf[MAXPATHLEN]; /* holds the real acl name */
+ char buf[1024]; /* holds the real acl name */
char *prefix;
int flag;
int retval;
@@ -89,7 +89,7 @@ access_check(char *sender,
}
if (!(acl->acl_types & flag)) /* no acl ==> no restriction */
return 1;
- sprintf(buf, "%s/%s-%s.acl", acl_dir, prefix, acl->acl_filename);
+ snprintf(buf, sizeof buf, "%s/%s-%s.acl", acl_dir, prefix, acl->acl_filename);
/*
* If we can't load it (because it probably doesn't exist),
* we deny access.
@@ -117,7 +117,7 @@ check_acl_type(Acl *acl,
Access accesstype,
int typeflag)
{
- char buf[MAXPATHLEN]; /* holds the real acl name */
+ char buf[1024]; /* holds the real acl name */
char *prefix;
switch (accesstype) {
@@ -137,7 +137,7 @@ check_acl_type(Acl *acl,
syslog(LOG_ERR, "unknown access type %d", (int) accesstype);
return;
}
- sprintf(buf, "%s/%s-%s.acl", acl_dir, prefix, acl->acl_filename);
+ snprintf(buf, sizeof buf, "%s/%s-%s.acl", acl_dir, prefix, acl->acl_filename);
if (!access(buf, F_OK))
acl->acl_types |= typeflag;
}
@@ -155,7 +155,7 @@ check_acl_type(Acl *acl,
static void
access_setup(int first)
{
- char buf[MAXPATHLEN];
+ char buf[1024];
char class_name[512]; /* assume class names <= 511 bytes */
FILE *registry;
Acl *acl;
@@ -163,7 +163,7 @@ access_setup(int first)
char *colon_idx;
Code_t retval = 0;
- sprintf(buf, "%s/%s", acl_dir, ZEPHYR_CLASS_REGISTRY);
+ snprintf(buf, sizeof buf, "%s/%s", acl_dir, ZEPHYR_CLASS_REGISTRY);
registry = fopen(buf, "r");
if (!registry) {
syslog(LOG_ERR, "no registry available, all classes are free");