/*
- * $Id: auth.c,v 1.51 2007-12-03 14:50:38 didg Exp $
+ * $Id: auth.c,v 1.61 2009-02-27 09:14:40 franklahm Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include <grp.h>
#include <atalk/logger.h>
#include <atalk/server_ipc.h>
+#include <atalk/uuid.h>
#ifdef TRU64
#include <netdb.h>
#include "uam_auth.h"
#include "switch.h"
#include "status.h"
-
#include "fork.h"
+#ifdef HAVE_NFSv4_ACLS
+#include "acls.h"
+#endif
+#ifdef HAVE_EXT_ATTRS
+#include "extattrs.h"
+#endif
int afp_version = 11;
static int afp_version_index;
{ "AFP2.2", 22 },
#ifdef AFP3x
{ "AFPX03", 30 },
- { "AFP3.1", 31 }
+ { "AFP3.1", 31 },
+ { "AFP3.2", 32 }
#endif
};
return AFPERR_PWDEXPR;
}
+static int afp_null_nolog(obj, ibuf, ibuflen, rbuf, rbuflen )
+AFPObj *obj _U_;
+char *ibuf _U_, *rbuf _U_;
+int ibuflen _U_, *rbuflen;
+{
+ *rbuflen = 0;
+ return( AFPERR_NOOP );
+}
static int set_auth_switch(int expired)
{
else {
afp_switch = postauth_switch;
switch (afp_version) {
+ case 32:
+ uam_afpserver_action(AFP_SPOTLIGHT_PRIVATE, UAM_AFPSERVER_POSTAUTH, afp_null_nolog, NULL);
+ uam_afpserver_action(AFP_SYNCDIR, UAM_AFPSERVER_POSTAUTH, afp_syncdir, NULL);
+ uam_afpserver_action(AFP_SYNCFORK, UAM_AFPSERVER_POSTAUTH, afp_syncfork, NULL);
+#ifdef HAVE_NFSv4_ACLS
+ uam_afpserver_action(AFP_GETACL, UAM_AFPSERVER_POSTAUTH, afp_getacl, NULL);
+ uam_afpserver_action(AFP_SETACL, UAM_AFPSERVER_POSTAUTH, afp_setacl, NULL);
+ uam_afpserver_action(AFP_ACCESS, UAM_AFPSERVER_POSTAUTH, afp_access, NULL);
+#endif
+#ifdef HAVE_EXT_ATTRS
+ uam_afpserver_action(AFP_GETEXTATTR, UAM_AFPSERVER_POSTAUTH, afp_getextattr, NULL);
+ uam_afpserver_action(AFP_SETEXTATTR, UAM_AFPSERVER_POSTAUTH, afp_setextattr, NULL);
+ uam_afpserver_action(AFP_REMOVEATTR, UAM_AFPSERVER_POSTAUTH, afp_remextattr, NULL);
+ uam_afpserver_action(AFP_LISTEXTATTR, UAM_AFPSERVER_POSTAUTH, afp_listextattr, NULL);
+#endif
case 31:
- uam_afpserver_action(AFP_ENUMERATE_EXT2, UAM_AFPSERVER_POSTAUTH, afp_enumerate_ext2, NULL);
+ uam_afpserver_action(AFP_ENUMERATE_EXT2, UAM_AFPSERVER_POSTAUTH, afp_enumerate_ext2, NULL);
case 30:
uam_afpserver_action(AFP_ENUMERATE_EXT, UAM_AFPSERVER_POSTAUTH, afp_enumerate_ext, NULL);
uam_afpserver_action(AFP_BYTELOCK_EXT, UAM_AFPSERVER_POSTAUTH, afp_bytelock_ext, NULL);
int admin = 0;
#endif /* ADMIN_GRP */
- /* UAM had syslog control; afpd needs to reassert itself */
+#if 0
set_processname("afpd");
- syslog_setup(log_debug, logtype_default, logoption_ndelay|logoption_pid, logfacility_daemon);
+#endif
if ( pwd->pw_uid == 0 ) { /* don't allow root login */
LOG(log_error, logtype_afpd, "login: root login denied!" );
u_int32_t id;
u_int16_t bitmap;
+ LOG(log_debug, logtype_afpd, "begin afp_getuserinfo:");
+
*rbuflen = 0;
ibuf++;
thisuser = *ibuf++;
*rbuflen += sizeof(id);
}
+#ifdef HAVE_NFSv4_ACLS
+ if (bitmap & USERIBIT_UUID) {
+ int ret;
+ uuid_t uuid;
+ char *uuidstring;
+
+ if ( ! (obj->options.flags & OPTION_UUID))
+ return AFPERR_BITMAP;
+ LOG(log_debug, logtype_afpd, "afp_getuserinfo: get UUID for \'%s\'", obj->username);
+ ret = getuuidfromname( obj->username, UUID_USER, uuid);
+ if (ret != 0) {
+ LOG(log_info, logtype_afpd, "afp_getuserinfo: error getting UUID !");
+ return AFPERR_NOITEM;
+ }
+ uuid_bin2string( uuid, &uuidstring);
+ LOG(log_debug, logtype_afpd, "afp_getuserinfo: got UUID: %s", uuidstring);
+ free(uuidstring);
+ memcpy(rbuf, uuid, UUID_BINSIZE);
+ rbuf += UUID_BINSIZE;
+ *rbuflen += UUID_BINSIZE;
+ }
+#endif
return AFP_OK;
+ LOG(log_debug, logtype_afpd, "END afp_getuserinfo:");
}
#define UAM_LIST(type) (((type) == UAM_SERVER_LOGIN || (type) == UAM_SERVER_LOGIN_EXT) ? &uam_login : \