netacnv
.deps
.libs
+*.o
+afpldaptest
-# Makefile.am for bin/aecho/
+# Makefile.am for bin/misc
bin_PROGRAMS = netacnv
netacnv_SOURCES = netacnv.c
netacnv_LDADD = $(top_builddir)/libatalk/libatalk.la
+pkgconfdir = @PKGCONFDIR@
+
+if USE_NFSv4_ACLS
+bin_PROGRAMS += afpldaptest
+
+afpldaptest_SOURCES = uuidtest.c
+afpldaptest_LDADD = $(top_builddir)/libatalk/libatalk.la
+
+AM_CFLAGS = -D_PATH_ACL_LDAPCONF=\"$(pkgconfdir)/afp_ldap.conf\"
+endif
--- /dev/null
+/*
+ $Id: uuidtest.c,v 1.1 2009-11-27 21:15:48 franklahm Exp $
+ Copyright (c) 2008,2009 Frank Lahm <franklahm@gmail.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#ifdef HAVE_NFSv4_ACLS
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <ldap.h>
+
+#include <atalk/ldapconfig.h>
+#include <atalk/uuid.h>
+#include <atalk/logger.h>
+
+#define STRNCMP(a, R, b, l) (strncmp(a,b,l) R 0)
+
+static void usage()
+{
+ printf("Usage: uuidtest -u <user> | -g <group> | -i <UUID>\n");
+}
+
+static void parse_ldapconf()
+{
+ static int inited = 0;
+
+ if (! inited) {
+ /* Parse afp_ldap.conf */
+ printf("Start parsing afp_ldap.conf\n");
+ acl_ldap_readconfig(_PATH_ACL_LDAPCONF);
+ printf("Finished parsing afp_ldap.conf\n");
+ if (ldap_config_valid) {
+ if (ldap_auth_method == LDAP_AUTH_NONE)
+ printf("afp_ldap.conf is ok. Using anonymous bind.\n");
+ else if (ldap_auth_method == LDAP_AUTH_SIMPLE)
+ printf("afp_ldap.conf is ok. Using simple bind.\n");
+ else {
+ ldap_config_valid = 0;
+ printf("afp_ldap.conf wants SASL which is not yet supported.\n");
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ printf("afp_ldap.conf is not ok.\n");
+ exit(EXIT_FAILURE);
+ }
+ inited = 1;
+ }
+}
+
+int main( int argc, char **argv)
+{
+ int ret, i, c;
+ int verbose = 0;
+ uuid_t uuid;
+ uuidtype_t type;
+ char *uuidstring = NULL;
+ char *name = NULL;
+
+ setuplog("default log_error /dev/tty");
+
+ while ((c = getopt(argc, argv, ":vu:g:i:")) != -1) {
+ switch(c) {
+
+ case 'v':
+ if (! verbose) {
+ verbose = 1;
+ setuplog("default log_debug /dev/tty");
+ }
+ break;
+
+ case 'u':
+ parse_ldapconf();
+ printf("Searching user: %s\n", optarg);
+ ret = getuuidfromname( optarg, UUID_USER, uuid);
+ if (ret == 0) {
+ uuid_bin2string( uuid, &uuidstring);
+ printf("User: %s ==> UUID: %s\n", optarg, uuidstring);
+ free(uuidstring);
+ } else {
+ printf("User %s not found.\n", optarg);
+ }
+ break;
+
+ case 'g':
+ parse_ldapconf();
+ printf("Searching group: %s\n", optarg);
+ ret = getuuidfromname( optarg, UUID_GROUP, uuid);
+ if (ret == 0) {
+ uuid_bin2string( uuid, &uuidstring);
+ printf("Group: %s ==> UUID: %s\n", optarg, uuidstring);
+ free(uuidstring);
+ } else {
+ printf("Group %s not found.\n", optarg);
+ }
+ break;
+
+ case 'i':
+ parse_ldapconf();
+ printf("Searching uuid: %s\n", optarg);
+ uuid_string2bin(optarg, uuid);
+ ret = getnamefromuuid( uuid, &name, &type);
+ if (ret == 0) {
+ if (type == UUID_USER)
+ printf("UUID: %s ==> User: %s\n", optarg, name);
+ else
+ printf("UUID: %s ==> Group: %s\n", optarg, name);
+ free(name);
+ } else {
+ printf("UUID: %s not found.\n", optarg);
+ }
+ break;
+
+ case ':':
+ case '?':
+ usage();
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ return 0;
+}
+
+#endif /* HAVE_NFSv4_ACLS */
-dnl $Id: configure.in,v 1.232 2009-11-26 11:09:08 franklahm Exp $
+dnl $Id: configure.in,v 1.233 2009-11-27 21:15:48 franklahm Exp $
dnl configure.in for netatalk
AC_INIT(etc/afpd/main.c)
config/Makefile
config/pam/Makefile
contrib/Makefile
- contrib/acltests/Makefile
contrib/macusers/Makefile
contrib/macusers/macusers
contrib/nu/Makefile
A2BOOT =
endif
-SUBDIRS = macusers nu printing shell_utils ${TIMELORD} ${A2BOOT} acltests
+SUBDIRS = macusers nu printing shell_utils ${TIMELORD} ${A2BOOT}
EXTRA_DIST = ICDumpSuffixMap
+++ /dev/null
-Makefile
-Makefile.in
-.deps
-.libs
-uuid.log
-uuidtest
+++ /dev/null
-pkgconfdir = @PKGCONFDIR@
-
-if USE_NFSv4_ACLS
-bin_PROGRAMS = uuidtest
-
-uuidtest_SOURCES = uuidtest.c
-uuidtest_LDADD = $(top_builddir)/libatalk/libatalk.la
-
-AM_CFLAGS = -D_PATH_ACL_LDAPCONF=\"$(pkgconfdir)/afp_ldap.conf\"
-endif
+++ /dev/null
-/*
- $Id: uuidtest.c,v 1.4 2009-11-27 15:50:26 franklahm Exp $
- Copyright (c) 2008,2009 Frank Lahm <franklahm@gmail.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#ifdef HAVE_NFSv4_ACLS
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <ldap.h>
-
-#include <atalk/ldapconfig.h>
-#include <atalk/uuid.h>
-
-#define STRNCMP(a, R, b, l) (strncmp(a,b,l) R 0)
-
-int main( int argc, char **argv)
-{
- int ret, i;
- uuid_t uuid;
- uuidtype_t type;
- char *uuidstring = NULL;
- char *name = NULL;
-
- if (argc < 2) {
- printf("Usage: uuidtest <name> | -u<UUID> [<name> ... | -u<UUID> ...] \n");
- return -1;
- }
-
- /* Parse afp_ldap.conf */
- printf("Start parsing afp_ldap.conf\n");
- acl_ldap_readconfig(_PATH_ACL_LDAPCONF);
- printf("Finished parsing afp_ldap.conf\n");
- if (ldap_config_valid) {
- if (ldap_auth_method == LDAP_AUTH_NONE)
- printf("afp_ldap.conf is ok. Using anonymous bind.\n");
- else if (ldap_auth_method == LDAP_AUTH_SIMPLE)
- printf("afp_ldap.conf is ok. Using simple bind.\n");
- else {
- ldap_config_valid = 0;
- printf("afp_ldap.conf want SASL which is not yet supported.\n");
- }
- } else {
- printf("afp_ldap.conf is not ok.\n");
- return 1;
- }
-
- for (i=1; i+1 <= argc; i++) {
- if (STRNCMP("-u", == , argv[i], 2)) {
- printf("Searching uuid: %s\n", argv[i]+2);
- uuid_string2bin(argv[i]+2, uuid);
- ret = getnamefromuuid( uuid, &name, &type);
- if (ret == 0) {
- printf("Got user: %s for uuid: %s, type:%d\n", name, argv[i]+2, type);
- free(uuidstring);
- } else
- printf("uuid %s not found.\n", argv[i]+2);
- } else {
- printf("Searching user: %s\n", argv[i]);
- ret = getuuidfromname( argv[i], UUID_USER, uuid);
- if (ret == 0) {
- uuid_bin2string( uuid, &uuidstring);
- printf("Got uuid: %s for name: %s, type: USER\n", uuidstring, argv[i]);
- free(uuidstring);
- } else {
- ret = getuuidfromname( argv[i], UUID_GROUP, uuid);
- if (ret == 0) {
- uuid_bin2string( uuid, &uuidstring);
- printf("Got uuid: %s for name: %s, type: GROUP\n", uuidstring, argv[i]);
- free(uuidstring);
- }
- else
- printf("User %s not found.\n", argv[i]);
- }
- }
- }
-
- return 0;
-}
-
-#endif /* HAVE_NFSv4_ACLS */
.br
.PP
You can use
-\fBuuidtest\fR(1)
+\fBafpldaptest\fR(1)
to syntactically check your config
.sp .5v
.EM yellow
.SH "See also"
.PP
\fBafpd\fR(8),
-\fBAppleVolumes.default\fR(5),\fBuuidtest\fR(1)
+\fBAppleVolumes.default\fR(5),\fBafpldaptest\fR(1)