extern char *ldap_userbase;
extern char *ldap_groupbase;
extern char *ldap_uuid_attr;
+extern char *ldap_uuid_string;
extern char *ldap_name_attr;
extern char *ldap_group_attr;
extern char *ldap_uid_attr;
#define AFP_UUID_H
#define UUID_BINSIZE 16
-#define UUID_STRINGSIZE 36
typedef unsigned char *uuidp_t;
typedef unsigned char atalk_uuid_t[UUID_BINSIZE];
#define UUIDTYPESTR_MASK 3
extern char *uuidtype[];
-/* afp_options.c needs these. defined in libatalk/ldap.c */
-extern char *ldap_host;
-extern int ldap_auth_method;
-extern char *ldap_auth_dn;
-extern char *ldap_auth_pw;
-extern char *ldap_userbase;
-extern char *ldap_groupbase;
-extern char *ldap_uuid_attr;
-extern char *ldap_name_attr;
-extern char *ldap_group_attr;
-extern char *ldap_uid_attr;
-
/********************************************************
* Interface
********************************************************/
char *ldap_groupbase;
int ldap_groupscope;
char *ldap_uuid_attr;
+char *ldap_uuid_string;
char *ldap_name_attr;
char *ldap_group_attr;
char *ldap_uid_attr;
{&ldap_groupbase, "ldap_groupbase", 0, 0, -1},
{&ldap_groupscope, "ldap_groupscope", 1 ,1, -1},
{&ldap_uuid_attr, "ldap_uuid_attr", 0, 0, -1},
+ {&ldap_uuid_string,"ldap_uuid_string", 0, 0, 0},
{&ldap_name_attr, "ldap_name_attr", 0, 0, -1},
{&ldap_group_attr, "ldap_group_attr", 0, 0, -1},
{&ldap_uid_attr, "ldap_uid_attr", 0, 0, 0},
#include <atalk/logger.h>
#include <atalk/afp.h>
#include <atalk/uuid.h>
+#include <atalk/ldapconfig.h>
#include <atalk/util.h>
#include "aclldap.h"
int nibble = 1;
int i = 0;
unsigned char c, val = 0;
-
- while (*uuidstring) {
+
+ while (*uuidstring && i < UUID_BINSIZE) {
c = *uuidstring;
if (c == '-') {
uuidstring++;
/*!
* Convert 16 byte binary uuid to neat ascii represantation including dashes.
- *
+ * Use defined or default ascii mask for dash placement
* Returns pointer to static buffer.
*/
const char *uuid_bin2string(unsigned char *uuid) {
- static char uuidstring[UUID_STRINGSIZE + 1];
-
+ static char uuidstring[64];
+ const char *uuidmask;
int i = 0;
unsigned char c;
- while (i < UUID_STRINGSIZE) {
+ if (ldap_uuid_string)
+ uuidmask = ldap_uuid_string;
+ else
+ uuidmask = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
+
+ LOG(log_debug, logtype_afpd, "uuid_bin2string{uuid}: mask: %s", uuidmask);
+
+ while (i < strlen(uuidmask)) {
c = *uuid;
uuid++;
sprintf(uuidstring + i, "%02X", c);
i += 2;
- if (i==8 || i==13 || i==18 || i==23)
+ if (uuidmask[i] == '-')
uuidstring[i++] = '-';
}
uuidstring[i] = 0;