From d5f3280d24efcdc24c861c26a4c32e967e16eee2 Mon Sep 17 00:00:00 2001 From: Karl Ramm Date: Tue, 24 Aug 2010 07:08:35 +0000 Subject: 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. --- server/access.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'server/access.c') 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"); -- cgit v1.2.3