/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
#include <errno.h>
#include <synch.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <syslog.h>
#include <fcntl.h>
#include <bsm/adt_event.h>
#include <bsm/audit_uevents.h>
#include <pwd.h>
#include <nss_dbdefs.h>
#include "smbd.h"
/*
* An audit session is established at user logon and terminated at user
* logoff.
*
* SMB audit handles are allocated when users logon (SmbSessionSetupX)
* and deallocted when a user logs off (SmbLogoffX). Each time an SMB
* audit handle is allocated it is added to a global list.
*/
typedef struct smb_audit {
char *sa_domain;
char *sa_username;
} smb_audit_t;
/*
* Unique identifier for audit sessions in the audit list.
* Used to lookup an audit session on logoff.
*/
static void smbd_audit_link(smb_audit_t *);
/*
* Invoked at user logon due to SmbSessionSetupX. Authenticate the
* user, start an audit session and audit the event.
*/
{
char *username;
char *domain;
char *sid;
int status;
int retval;
return (NULL);
}
} else {
}
uid = ADT_NO_ATTRIB;
gid = ADT_NO_ATTRIB;
} else {
}
return (NULL);
}
"adt_alloc_event(ADT_smbd_session): %m");
(void) adt_end_session(ah);
return (NULL);
}
} else {
sizeof (in6_addr_t));
}
(void) adt_end_session(ah);
return (NULL);
}
if (token) {
(void) adt_end_session(ah);
return (NULL);
}
}
return (token);
}
/*
* Logon due to a subsequent SmbSessionSetupX on an existing session.
* The user was authenticated during the initial session setup.
*/
void
{
(void) mutex_lock(&smbd_audit_lock);
while (entry) {
break;
}
}
(void) mutex_unlock(&smbd_audit_lock);
}
/*
* Invoked at user logoff due to SmbLogoffX. If this is the final
* logoff for this user on the session, audit the event and terminate
* the audit session.
*/
void
{
return;
} else {
return;
}
"adt_alloc_event(ADT_smbd_logoff): %m");
} else {
}
(void) adt_end_session(ah);
}
/*
* Allocate an id and link an audit handle onto the global list.
*/
static void
{
(void) mutex_lock(&smbd_audit_lock);
do {
(void) mutex_unlock(&smbd_audit_lock);
}
/*
* Unlink an audit handle. If the reference count reaches 0, the entry
* is removed from the list and returned. Otherwise the entry remains
* on the list and a null pointer is returned.
*/
static smb_audit_t *
{
(void) mutex_lock(&smbd_audit_lock);
ppe = &smbd_audit_list;
while (*ppe) {
break;
break;
(void) mutex_unlock(&smbd_audit_lock);
return (entry);
}
}
(void) mutex_unlock(&smbd_audit_lock);
return (NULL);
}