cmdgen_share_nfs.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <errno.h>
#include "cmdgen_include.h"
#include "nfs_share_attr.h"
#include "nfs_sharesecurity_attr.h"
#include "Solaris_NFSShare.h"
/*
* Private data type declaration
*/
#define NFS_SHARE_CMD "share -F nfs"
#define SPEC_OPT_FLAG "-o"
/*
* Private method declarations
*/
static char *create_shareopt_string(CCIMInstance *, int *);
static char *add_option_string(char *, char *, int *);
static char *create_sharesec_optstring(CCIMInstance *, int *);
/*
* Public methods
*/
/*
* generates the share command string
* memory returned must be freed by the caller.
*/
/* ARGSUSED */
char *
{
char *share_desc;
char *cmd;
char *shareopts;
char *sharesecopts;
/*
* Create the share command using the properties
* passed in from inst.
*/
/*
* Get the share description attribute if the "-d"
* flag is set.
*/
share_Prop->mValue);
} else {
}
if (share_Prop == NULL) {
return ((char *)NULL);
}
} else {
share_Prop->mValue);
}
}
cmd);
return (cmd);
} else {
return ((char *)cmd);
}
/*
* Not reached
*/
}
/*
* Private methods
*/
/*
* creates and returns the options string by gathering the vaious share
* options from the instance attributes.
*/
static char *
{
/*
* Check AllowAccessControll
*/
if (share_Prop != NULL) {
/*
* add the "aclok" attribute to the shareopt string.
*/
return (NULL);
}
}
/*
* Check EffectiveUID
*/
if (share_Prop != NULL) {
char *tmp;
share_Prop->mValue);
/*
* add "anon=" attribute and value to shareopt sting.
*/
return (NULL);
}
}
/*
* Check IgnoreSetID
*/
if (share_Prop != NULL) {
/*
* add "nosuid" attribute to shareopt sting.
*/
return (NULL);
}
}
/*
* Check LogFileTag
*/
if (share_Prop != NULL) {
char *tmp;
share_Prop->mValue);
/*
* add "log=" attribute and value to shareopt sting.
*/
return (NULL);
}
}
/*
* Check PreventSubdirMount
*/
if (share_Prop != NULL) {
/*
* add "nosub" attribute to shareopt sting.
*/
return (NULL);
}
}
/*
* Check Public
*/
if (share_Prop != NULL) {
/*
* add "public" attribute to shareopt sting.
*/
error);
return (NULL);
}
}
cim_logDebug("create_shareopt_string",
"The share opts string is: %s", shareopts);
} else {
cim_logDebug("create_shareopt_string",
"The share opts string is NULL");
}
return (shareopts);
}
/*
* Adds the option to the existing option string. The existing option
* string may be reallocated. In either case, the new pointer to
* the complete string is returned.
*/
static char *
{
char *ret_val;
} else {
} else
}
return (ret_val);
}
/*
* creates and returns the security options string
*/
static char *
{
char **securityStrings;
char *optstring;
int number_of_strings;
/*
* No security options specified.
*/
return (NULL);
}
if (securityStrings != NULL) {
int i;
for (i = 0; i < number_of_strings; i++) {
securityStrings[i], err);
return (NULL);
}
}
cim_logDebug("create_sharesec_optstring",
"The share security opts string is: %s", optstring);
} else {
cim_logDebug("create_sharesec_optstring",
"The share security opts string is NULL");
}
return (optstring);
}