/*
- * $Id: afp_config.c,v 1.23 2005-04-28 20:49:39 bfernhomberg Exp $
+ * $Id: afp_config.c,v 1.28 2009-10-29 11:35:58 didg Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All Rights Reserved. See COPYRIGHT.
#ifdef USE_SRVLOC
#include <slp.h>
#endif /* USE_SRVLOC */
+#ifdef HAVE_NFSv4_ACLS
+#include <atalk/ldapconfig.h>
+#endif
#include "globals.h"
#include "afp_config.h"
/* Convert name to maccharset */
if ((size_t)-1 ==(convert_string_allocate( options->unixcharset, options->maccharset,
- name, strlen(name), &conv_name)) )
+ name, -1, &conv_name)) )
return (char*)name;
/* Escape characters */
{
FILE *fp;
char buf[LINESIZE + 1], *p, have_option = 0;
+ size_t len;
struct afp_options options;
AFPConfig *config=NULL, *first = NULL;
+#ifdef HAVE_NFSv4_ACLS
+ /* Parse ldap.conf first so we can set the uuid option */
+ LOG(log_debug, logtype_afpd, "Start parsing ldap.conf");
+ acl_ldap_readconfig(_PATH_ACL_LDAPCONF);
+ LOG(log_debug, logtype_afpd, "Finished parsing ldap.conf");
+#endif
+
status_reset();
/* if config file doesn't exist, load defaults */
if ((fp = fopen(cmdline->configfile, "r")) == NULL)
LOG(log_debug, logtype_afpd, "Loading ConfigFile");
/* scan in the configuration file */
+ len = 0;
while (!feof(fp)) {
- if (!fgets(buf, sizeof(buf), fp) || buf[0] == '#')
+ if (!fgets(&buf[len], LINESIZE - len, fp) || buf[len] == '#')
continue;
+ len = strlen(buf);
+ if ( len >= 2 && buf[len-2] == '\\' ) {
+ len -= 2;
+ continue;
+ } else
+ len = 0;
/* a little pre-processing to get rid of spaces and end-of-lines */
p = buf;
if (!afp_options_parseline(p, &options))
continue;
+#ifdef HAVE_NFSv4_ACLS
+ /* Enable UUID support if LDAP config is complete */
+ if (ldap_config_valid)
+ options.flags |= OPTION_UUID;
+#endif
+
/* this should really get a head and a tail to simplify things. */
if (!first) {
if ((first = AFPConfigInit(&options, cmdline)))
fclose(fp);
if (!have_option)
- return AFPConfigInit(cmdline, cmdline);
+ first = AFPConfigInit(cmdline, cmdline);
return first;
}