smbd_share_doorsvc.c revision da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* LanMan share door server
*/
#include <door.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <syslog.h>
#include <string.h>
#include <pthread.h>
#include <smbsrv/lmshare_door.h>
static smb_kmod_cfg_t smb_kcfg;
static int smb_lmshrd_fildes = -1;
/* forward declaration */
/*
* smb_lmshrd_srv_start
*
* Start the LanMan share door service.
* Returns 0 on success. Otherwise, -1.
*/
int
{
int newfd;
(void) pthread_mutex_lock(&smb_lmshrd_srv_mutex);
if (smb_lmshrd_fildes != -1) {
(void) pthread_mutex_unlock(&smb_lmshrd_srv_mutex);
return (0);
}
(void) pthread_mutex_unlock(&smb_lmshrd_srv_mutex);
return (-1);
}
(void) unlink(LMSHR_DOOR_NAME);
(void) door_revoke(smb_lmshrd_fildes);
smb_lmshrd_fildes = -1;
(void) pthread_mutex_unlock(&smb_lmshrd_srv_mutex);
return (-1);
}
(void) fdetach(LMSHR_DOOR_NAME);
(void) door_revoke(smb_lmshrd_fildes);
smb_lmshrd_fildes = -1;
(void) pthread_mutex_unlock(&smb_lmshrd_srv_mutex);
return (-1);
}
(void) pthread_mutex_unlock(&smb_lmshrd_srv_mutex);
return (0);
}
/*
* smb_lmshrd_srv_stop
*
* Stop the LanMan share door service.
*/
void
smb_lmshrd_srv_stop(void)
{
(void) pthread_mutex_lock(&smb_lmshrd_srv_mutex);
if (smb_lmshrd_fildes != -1) {
(void) fdetach(LMSHR_DOOR_NAME);
(void) door_revoke(smb_lmshrd_fildes);
smb_lmshrd_fildes = -1;
}
(void) pthread_mutex_unlock(&smb_lmshrd_srv_mutex);
}
/*
* smb_lmshrd_srv_door
*
* This function with which the LMSHARE door is associated
* will invoke the appropriate CIFS share management function
* based on the request type of the door call.
*/
/*ARGSUSED*/
void
{
char buf[LMSHR_DOOR_SIZE];
unsigned int used;
unsigned int dec_status;
unsigned int enc_status;
char *sharename, *sharename2;
int offset;
switch (req_type) {
case LMSHR_DOOR_OPEN_ITERATOR:
goto decode_error;
break;
goto decode_error;
break;
case LMSHR_DOOR_ITERATE:
goto decode_error;
break;
case LMSHR_DOOR_NUM_SHARES:
goto decode_error;
rc = lmshare_num_shares();
break;
case LMSHR_DOOR_DELETE:
goto decode_error;
}
break;
case LMSHR_DOOR_RENAME:
goto decode_error;
}
break;
case LMSHR_DOOR_GETINFO:
goto decode_error;
}
break;
case LMSHR_DOOR_ADD:
goto decode_error;
break;
case LMSHR_DOOR_SETINFO:
goto decode_error;
break;
case LMSHR_DOOR_EXISTS:
case LMSHR_DOOR_IS_SPECIAL:
case LMSHR_DOOR_IS_RESTRICTED:
case LMSHR_DOOR_IS_ADMIN:
case LMSHR_DOOR_IS_VALID:
case LMSHR_DOOR_IS_DIR:
goto decode_error;
}
break;
case LMSHR_DOOR_LIST:
goto decode_error;
break;
case SMB_GET_KCONFIG:
break;
default:
goto decode_error;
}
goto encode_error;
return;
return;
}
/*
* smb_lmshrd_srv_check
*
* Depending upon the opcode, this function will
* the the type of the specified share.
*/
static int
{
int rc;
switch (opcode) {
case LMSHR_DOOR_EXISTS:
break;
case LMSHR_DOOR_IS_SPECIAL:
break;
case LMSHR_DOOR_IS_RESTRICTED:
break;
case LMSHR_DOOR_IS_ADMIN:
break;
case LMSHR_DOOR_IS_VALID:
break;
case LMSHR_DOOR_IS_DIR:
}
return (rc);
}