mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
Jeremy is going to hate me ...
These are some hacks on SWAT. Maybe users will actually be able to
work out how to use it now.
Unfortunately these changes required some editing in loadparm.c and
smb.h which will make Jeremys merge job harder. Sorry!
(This used to be commit 674c88a6bf
)
This commit is contained in:
parent
f3eeb2f1fa
commit
35d67dd80a
@ -43,6 +43,7 @@ static int content_length;
|
||||
static int request_post;
|
||||
static int request_get;
|
||||
static char *query_string;
|
||||
static char *baseurl;
|
||||
|
||||
static void unescape(char *buf)
|
||||
{
|
||||
@ -610,12 +611,20 @@ void cgi_setup(char *rootdir)
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
if (strcmp(url,"/")) {
|
||||
if (strstr(url+1,"..")==0 && file_exist(url+1)) {
|
||||
cgi_download(url+1);
|
||||
}
|
||||
|
||||
printf("HTTP/1.1 200 OK\r\nConnection: close\r\n");
|
||||
|
||||
|
||||
baseurl = url+1;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
return the current pages URL
|
||||
***************************************************************************/
|
||||
char *cgi_baseurl(void)
|
||||
{
|
||||
return baseurl;
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ char *urlquote(char *s);
|
||||
char *quotequotes(char *s);
|
||||
void quote_spaces(char *buf);
|
||||
void cgi_setup(char *rootdir);
|
||||
char *cgi_baseurl(void);
|
||||
|
||||
/*The following definitions come from charcnv.c */
|
||||
|
||||
@ -382,9 +383,9 @@ BOOL lp_add_home(char *pszHomename, int iDefaultService, char *pszHomedir);
|
||||
int lp_add_service(char *pszService, int iDefaultService);
|
||||
BOOL lp_add_printer(char *pszPrintername, int iDefaultService);
|
||||
BOOL lp_file_list_changed(void);
|
||||
void *lp_local_ptr(int snum, void *ptr);
|
||||
BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue);
|
||||
int lp_next_parameter(int snum, int *i, char *label,
|
||||
char *value, int allparameters);
|
||||
struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters);
|
||||
BOOL lp_snum_ok(int iService);
|
||||
BOOL lp_loaded(void);
|
||||
void lp_killunused(BOOL (*snumused)(int ));
|
||||
|
@ -1643,6 +1643,39 @@ struct connection_options {
|
||||
uint16 serverzone;
|
||||
};
|
||||
|
||||
/* the following are used by loadparm for option lists */
|
||||
typedef enum
|
||||
{
|
||||
P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,
|
||||
P_STRING,P_USTRING,P_GSTRING,P_UGSTRING,P_ENUM
|
||||
} parm_type;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
P_LOCAL,P_GLOBAL,P_NONE
|
||||
} parm_class;
|
||||
|
||||
struct enum_list {
|
||||
int value;
|
||||
char *name;
|
||||
};
|
||||
|
||||
struct parm_struct
|
||||
{
|
||||
char *label;
|
||||
parm_type type;
|
||||
parm_class class;
|
||||
void *ptr;
|
||||
BOOL (*special)();
|
||||
struct enum_list *enum_list;
|
||||
unsigned flags;
|
||||
};
|
||||
|
||||
|
||||
#define FLAG_BASIC 1
|
||||
#define FLAG_HIDE 2
|
||||
#define FLAG_PRINT 4
|
||||
|
||||
#ifndef LOCKING_VERSION
|
||||
#define LOCKING_VERSION 4
|
||||
#endif /* LOCKING_VERSION */
|
||||
|
@ -89,18 +89,6 @@ extern pstring myname;
|
||||
#define LP_SNUM_OK(iService) (((iService) >= 0) && ((iService) < iNumServices) && iSERVICE(iService).valid)
|
||||
#define VALID(i) iSERVICE(i).valid
|
||||
|
||||
/* these are the types of parameter we have */
|
||||
typedef enum
|
||||
{
|
||||
P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,
|
||||
P_STRING,P_USTRING,P_GSTRING,P_UGSTRING,P_ENUM
|
||||
} parm_type;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
P_LOCAL,P_GLOBAL,P_NONE
|
||||
} parm_class;
|
||||
|
||||
int keepalive=0;
|
||||
extern BOOL use_getwd_cache;
|
||||
|
||||
@ -402,11 +390,6 @@ static BOOL handle_coding_system(char *pszParmValue,char **ptr);
|
||||
|
||||
static void set_default_server_announce_type(void);
|
||||
|
||||
struct enum_list {
|
||||
int value;
|
||||
char *name;
|
||||
};
|
||||
|
||||
static struct enum_list enum_protocol[] = {{PROTOCOL_NT1, "NT1"}, {PROTOCOL_LANMAN2, "LANMAN2"},
|
||||
{PROTOCOL_LANMAN1, "LANMAN1"}, {PROTOCOL_CORE,"CORE"},
|
||||
{PROTOCOL_COREPLUS, "COREPLUS"},
|
||||
@ -427,221 +410,213 @@ static struct enum_list enum_case[] = {{CASE_LOWER, "lower"}, {CASE_UPPER, "uppe
|
||||
|
||||
static struct enum_list enum_lm_announce[] = {{0, "False"}, {1, "True"}, {2, "Auto"}, {-1, NULL}};
|
||||
|
||||
static struct parm_struct
|
||||
static struct parm_struct parm_table[] =
|
||||
{
|
||||
char *label;
|
||||
parm_type type;
|
||||
parm_class class;
|
||||
void *ptr;
|
||||
BOOL (*special)();
|
||||
struct enum_list *enum_list;
|
||||
} parm_table[] =
|
||||
{
|
||||
{"debuglevel", P_INTEGER, P_GLOBAL, &DEBUGLEVEL, NULL, NULL},
|
||||
{"log level", P_INTEGER, P_GLOBAL, &DEBUGLEVEL, NULL, NULL},
|
||||
{"syslog", P_INTEGER, P_GLOBAL, &Globals.syslog, NULL, NULL},
|
||||
{"syslog only", P_BOOL, P_GLOBAL, &Globals.bSyslogOnly, NULL, NULL},
|
||||
{"protocol", P_ENUM, P_GLOBAL, &Globals.maxprotocol, NULL, enum_protocol},
|
||||
{"security", P_ENUM, P_GLOBAL, &Globals.security, NULL, enum_security},
|
||||
{"max disk size", P_INTEGER, P_GLOBAL, &Globals.maxdisksize, NULL, NULL},
|
||||
{"lpq cache time", P_INTEGER, P_GLOBAL, &Globals.lpqcachetime, NULL, NULL},
|
||||
{"announce as", P_ENUM, P_GLOBAL, &Globals.announce_as, NULL, enum_announce_as},
|
||||
{"encrypt passwords",P_BOOL, P_GLOBAL, &Globals.bEncryptPasswords, NULL, NULL},
|
||||
{"getwd cache", P_BOOL, P_GLOBAL, &use_getwd_cache, NULL, NULL},
|
||||
{"read prediction", P_BOOL, P_GLOBAL, &Globals.bReadPrediction, NULL, NULL},
|
||||
{"read bmpx", P_BOOL, P_GLOBAL, &Globals.bReadbmpx, NULL, NULL},
|
||||
{"read raw", P_BOOL, P_GLOBAL, &Globals.bReadRaw, NULL, NULL},
|
||||
{"write raw", P_BOOL, P_GLOBAL, &Globals.bWriteRaw, NULL, NULL},
|
||||
{"use rhosts", P_BOOL, P_GLOBAL, &Globals.bUseRhosts, NULL, NULL},
|
||||
{"load printers", P_BOOL, P_GLOBAL, &Globals.bLoadPrinters, NULL, NULL},
|
||||
{"null passwords", P_BOOL, P_GLOBAL, &Globals.bNullPasswords, NULL, NULL},
|
||||
{"strip dot", P_BOOL, P_GLOBAL, &Globals.bStripDot, NULL, NULL},
|
||||
{"interfaces", P_STRING, P_GLOBAL, &Globals.szInterfaces, NULL, NULL},
|
||||
{"bind interfaces only", P_BOOL,P_GLOBAL, &Globals.bBindInterfacesOnly,NULL, NULL},
|
||||
{"networkstation user login", P_BOOL,P_GLOBAL, &Globals.bNetWkstaUserLogon,NULL, NULL},
|
||||
{"password server", P_STRING, P_GLOBAL, &Globals.szPasswordServer, NULL, NULL},
|
||||
{"socket options", P_GSTRING, P_GLOBAL, user_socket_options, NULL, NULL},
|
||||
{"netbios name", P_UGSTRING,P_GLOBAL, myname, NULL, NULL},
|
||||
{"netbios aliases", P_STRING, P_GLOBAL, &Globals.szNetbiosAliases, NULL, NULL},
|
||||
{"smbrun", P_STRING, P_GLOBAL, &Globals.szSmbrun, NULL, NULL},
|
||||
{"log file", P_STRING, P_GLOBAL, &Globals.szLogFile, NULL, NULL},
|
||||
{"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL},
|
||||
{"smb passwd file", P_STRING, P_GLOBAL, &Globals.szSMBPasswdFile, NULL, NULL},
|
||||
{"hosts equiv", P_STRING, P_GLOBAL, &Globals.szHostsEquiv, NULL, NULL},
|
||||
{"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL},
|
||||
{"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL},
|
||||
{"server string", P_STRING, P_GLOBAL, &Globals.szServerString, NULL, NULL},
|
||||
{"printcap name", P_STRING, P_GLOBAL, &Globals.szPrintcapname, NULL, NULL},
|
||||
{"printcap", P_STRING, P_GLOBAL, &Globals.szPrintcapname, NULL, NULL},
|
||||
{"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL},
|
||||
{"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL},
|
||||
{"root directory", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL},
|
||||
{"root dir", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL},
|
||||
{"root", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL},
|
||||
{"default service", P_STRING, P_GLOBAL, &Globals.szDefaultService, NULL, NULL},
|
||||
{"default", P_STRING, P_GLOBAL, &Globals.szDefaultService, NULL, NULL},
|
||||
{"message command", P_STRING, P_GLOBAL, &Globals.szMsgCommand, NULL, NULL},
|
||||
{"dfree command", P_STRING, P_GLOBAL, &Globals.szDfree, NULL, NULL},
|
||||
{"passwd program", P_STRING, P_GLOBAL, &Globals.szPasswdProgram, NULL, NULL},
|
||||
{"passwd chat", P_STRING, P_GLOBAL, &Globals.szPasswdChat, NULL, NULL},
|
||||
{"valid chars", P_STRING, P_GLOBAL, &Globals.szValidChars, handle_valid_chars, NULL},
|
||||
{"workgroup", P_USTRING, P_GLOBAL, &Globals.szWorkGroup, NULL, NULL},
|
||||
{"log level", P_INTEGER, P_GLOBAL, &DEBUGLEVEL, NULL, NULL, FLAG_BASIC},
|
||||
{"debuglevel", P_INTEGER, P_GLOBAL, &DEBUGLEVEL, NULL, NULL, 0},
|
||||
{"syslog", P_INTEGER, P_GLOBAL, &Globals.syslog, NULL, NULL, 0},
|
||||
{"syslog only", P_BOOL, P_GLOBAL, &Globals.bSyslogOnly, NULL, NULL, 0},
|
||||
{"protocol", P_ENUM, P_GLOBAL, &Globals.maxprotocol, NULL, enum_protocol, 0},
|
||||
{"security", P_ENUM, P_GLOBAL, &Globals.security, NULL, enum_security, FLAG_BASIC},
|
||||
{"max disk size", P_INTEGER, P_GLOBAL, &Globals.maxdisksize, NULL, NULL, 0},
|
||||
{"lpq cache time", P_INTEGER, P_GLOBAL, &Globals.lpqcachetime, NULL, NULL, 0},
|
||||
{"announce as", P_ENUM, P_GLOBAL, &Globals.announce_as, NULL, enum_announce_as, 0},
|
||||
{"encrypt passwords",P_BOOL, P_GLOBAL, &Globals.bEncryptPasswords, NULL, NULL, FLAG_BASIC},
|
||||
{"getwd cache", P_BOOL, P_GLOBAL, &use_getwd_cache, NULL, NULL, 0},
|
||||
{"read prediction", P_BOOL, P_GLOBAL, &Globals.bReadPrediction, NULL, NULL, 0},
|
||||
{"read bmpx", P_BOOL, P_GLOBAL, &Globals.bReadbmpx, NULL, NULL, 0},
|
||||
{"read raw", P_BOOL, P_GLOBAL, &Globals.bReadRaw, NULL, NULL, 0},
|
||||
{"write raw", P_BOOL, P_GLOBAL, &Globals.bWriteRaw, NULL, NULL, 0},
|
||||
{"use rhosts", P_BOOL, P_GLOBAL, &Globals.bUseRhosts, NULL, NULL, 0},
|
||||
{"load printers", P_BOOL, P_GLOBAL, &Globals.bLoadPrinters, NULL, NULL, 0},
|
||||
{"null passwords", P_BOOL, P_GLOBAL, &Globals.bNullPasswords, NULL, NULL, 0},
|
||||
{"strip dot", P_BOOL, P_GLOBAL, &Globals.bStripDot, NULL, NULL, 0},
|
||||
{"interfaces", P_STRING, P_GLOBAL, &Globals.szInterfaces, NULL, NULL, FLAG_BASIC},
|
||||
{"bind interfaces only", P_BOOL,P_GLOBAL, &Globals.bBindInterfacesOnly,NULL, NULL, 0},
|
||||
{"networkstation user login", P_BOOL,P_GLOBAL, &Globals.bNetWkstaUserLogon,NULL, NULL, 0},
|
||||
{"password server", P_STRING, P_GLOBAL, &Globals.szPasswordServer, NULL, NULL, 0},
|
||||
{"socket options", P_GSTRING, P_GLOBAL, user_socket_options, NULL, NULL, 0},
|
||||
{"netbios name", P_UGSTRING,P_GLOBAL, myname, NULL, NULL, FLAG_BASIC},
|
||||
{"netbios aliases", P_STRING, P_GLOBAL, &Globals.szNetbiosAliases, NULL, NULL, 0},
|
||||
{"smbrun", P_STRING, P_GLOBAL, &Globals.szSmbrun, NULL, NULL, 0},
|
||||
{"log file", P_STRING, P_GLOBAL, &Globals.szLogFile, NULL, NULL, 0},
|
||||
{"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL, 0},
|
||||
{"smb passwd file", P_STRING, P_GLOBAL, &Globals.szSMBPasswdFile, NULL, NULL, 0},
|
||||
{"hosts equiv", P_STRING, P_GLOBAL, &Globals.szHostsEquiv, NULL, NULL, 0},
|
||||
{"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, 0},
|
||||
{"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, 0},
|
||||
{"server string", P_STRING, P_GLOBAL, &Globals.szServerString, NULL, NULL, FLAG_BASIC},
|
||||
{"printcap name", P_STRING, P_GLOBAL, &Globals.szPrintcapname, NULL, NULL, 0},
|
||||
{"printcap", P_STRING, P_GLOBAL, &Globals.szPrintcapname, NULL, NULL, 0},
|
||||
{"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, 0},
|
||||
{"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, 0},
|
||||
{"root directory", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, 0},
|
||||
{"root dir", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, 0},
|
||||
{"root", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, 0},
|
||||
{"default service", P_STRING, P_GLOBAL, &Globals.szDefaultService, NULL, NULL, 0},
|
||||
{"default", P_STRING, P_GLOBAL, &Globals.szDefaultService, NULL, NULL, 0},
|
||||
{"message command", P_STRING, P_GLOBAL, &Globals.szMsgCommand, NULL, NULL, 0},
|
||||
{"dfree command", P_STRING, P_GLOBAL, &Globals.szDfree, NULL, NULL, 0},
|
||||
{"passwd program", P_STRING, P_GLOBAL, &Globals.szPasswdProgram, NULL, NULL, 0},
|
||||
{"passwd chat", P_STRING, P_GLOBAL, &Globals.szPasswdChat, NULL, NULL, 0},
|
||||
{"valid chars", P_STRING, P_GLOBAL, &Globals.szValidChars, handle_valid_chars, NULL, 0},
|
||||
{"workgroup", P_USTRING, P_GLOBAL, &Globals.szWorkGroup, NULL, NULL, FLAG_BASIC},
|
||||
#ifdef NTDOMAIN
|
||||
{"domain sid", P_USTRING, P_GLOBAL, &Globals.szDomainSID, NULL, NULL},
|
||||
{"domain other sids",P_STRING, P_GLOBAL, &Globals.szDomainOtherSIDs, NULL, NULL},
|
||||
{"domain groups", P_STRING, P_GLOBAL, &Globals.szDomainGroups, NULL, NULL},
|
||||
{"domain controller",P_BOOL , P_GLOBAL, &Globals.bDomainController,NULL, NULL},
|
||||
{"domain admin users",P_STRING, P_GLOBAL, &Globals.szDomainAdminUsers, NULL, NULL},
|
||||
{"domain guest users",P_STRING, P_GLOBAL, &Globals.szDomainGuestUsers, NULL, NULL},
|
||||
{"domain hosts allow",P_STRING, P_GLOBAL, &Globals.szDomainHostsallow, NULL, NULL},
|
||||
{"domain allow hosts",P_STRING, P_GLOBAL, &Globals.szDomainHostsallow, NULL, NULL},
|
||||
{"domain hosts deny", P_STRING, P_GLOBAL, &Globals.szDomainHostsdeny, NULL, NULL},
|
||||
{"domain deny hosts", P_STRING, P_GLOBAL, &Globals.szDomainHostsdeny, NULL, NULL},
|
||||
{"domain sid", P_USTRING, P_GLOBAL, &Globals.szDomainSID, NULL, NULL, 0},
|
||||
{"domain other sids",P_STRING, P_GLOBAL, &Globals.szDomainOtherSIDs, NULL, NULL, 0},
|
||||
{"domain groups", P_STRING, P_GLOBAL, &Globals.szDomainGroups, NULL, NULL, 0},
|
||||
{"domain controller",P_BOOL , P_GLOBAL, &Globals.bDomainController,NULL, NULL, 0},
|
||||
{"domain admin users",P_STRING, P_GLOBAL, &Globals.szDomainAdminUsers, NULL, NULL, 0},
|
||||
{"domain guest users",P_STRING, P_GLOBAL, &Globals.szDomainGuestUsers, NULL, NULL, 0},
|
||||
{"domain hosts allow",P_STRING, P_GLOBAL, &Globals.szDomainHostsallow, NULL, NULL, 0},
|
||||
{"domain allow hosts",P_STRING, P_GLOBAL, &Globals.szDomainHostsallow, NULL, NULL, 0},
|
||||
{"domain hosts deny", P_STRING, P_GLOBAL, &Globals.szDomainHostsdeny, NULL, NULL, 0},
|
||||
{"domain deny hosts", P_STRING, P_GLOBAL, &Globals.szDomainHostsdeny, NULL, NULL, 0},
|
||||
#endif /* NTDOMAIN */
|
||||
{"username map", P_STRING, P_GLOBAL, &Globals.szUsernameMap, NULL, NULL},
|
||||
{"character set", P_STRING, P_GLOBAL, &Globals.szCharacterSet, handle_character_set, NULL},
|
||||
{"logon script", P_STRING, P_GLOBAL, &Globals.szLogonScript, NULL, NULL},
|
||||
{"logon path", P_STRING, P_GLOBAL, &Globals.szLogonPath, NULL, NULL},
|
||||
{"logon drive", P_STRING, P_GLOBAL, &Globals.szLogonDrive, NULL, NULL},
|
||||
{"logon home", P_STRING, P_GLOBAL, &Globals.szLogonHome, NULL, NULL},
|
||||
{"remote announce", P_STRING, P_GLOBAL, &Globals.szRemoteAnnounce, NULL, NULL},
|
||||
{"remote browse sync",P_STRING, P_GLOBAL, &Globals.szRemoteBrowseSync,NULL, NULL},
|
||||
{"socket address", P_STRING, P_GLOBAL, &Globals.szSocketAddress, NULL, NULL},
|
||||
{"homedir map", P_STRING, P_GLOBAL, &Globals.szNISHomeMapName, NULL, NULL},
|
||||
{"announce version", P_STRING, P_GLOBAL, &Globals.szAnnounceVersion, NULL, NULL},
|
||||
{"max log size", P_INTEGER, P_GLOBAL, &Globals.max_log_size, NULL, NULL},
|
||||
{"mangled stack", P_INTEGER, P_GLOBAL, &Globals.mangled_stack, NULL, NULL},
|
||||
{"max mux", P_INTEGER, P_GLOBAL, &Globals.max_mux, NULL, NULL},
|
||||
{"max xmit", P_INTEGER, P_GLOBAL, &Globals.max_xmit, NULL, NULL},
|
||||
{"max packet", P_INTEGER, P_GLOBAL, &Globals.max_packet, NULL, NULL},
|
||||
{"packet size", P_INTEGER, P_GLOBAL, &Globals.max_packet, NULL, NULL},
|
||||
{"password level", P_INTEGER, P_GLOBAL, &Globals.pwordlevel, NULL, NULL},
|
||||
{"username level", P_INTEGER, P_GLOBAL, &Globals.unamelevel, NULL, NULL},
|
||||
{"keepalive", P_INTEGER, P_GLOBAL, &keepalive, NULL, NULL},
|
||||
{"deadtime", P_INTEGER, P_GLOBAL, &Globals.deadtime, NULL, NULL},
|
||||
{"time offset", P_INTEGER, P_GLOBAL, &extra_time_offset, NULL, NULL},
|
||||
{"read size", P_INTEGER, P_GLOBAL, &Globals.ReadSize, NULL, NULL},
|
||||
{"shared mem size", P_INTEGER, P_GLOBAL, &Globals.shmem_size, NULL, NULL},
|
||||
{"coding system", P_STRING, P_GLOBAL, &Globals.szCodingSystem, handle_coding_system, NULL},
|
||||
{"client code page", P_INTEGER, P_GLOBAL, &Globals.client_code_page, NULL, NULL},
|
||||
{"os level", P_INTEGER, P_GLOBAL, &Globals.os_level, NULL, NULL},
|
||||
{"max ttl", P_INTEGER, P_GLOBAL, &Globals.max_ttl, NULL, NULL},
|
||||
{"max wins ttl", P_INTEGER, P_GLOBAL, &Globals.max_wins_ttl, NULL, NULL},
|
||||
{"min wins ttl", P_INTEGER, P_GLOBAL, &Globals.min_wins_ttl, NULL, NULL},
|
||||
{"lm announce", P_ENUM, P_GLOBAL, &Globals.lm_announce, NULL, enum_lm_announce},
|
||||
{"lm interval", P_INTEGER, P_GLOBAL, &Globals.lm_interval, NULL, NULL},
|
||||
{"dns proxy", P_BOOL, P_GLOBAL, &Globals.bDNSproxy, NULL, NULL},
|
||||
{"wins support", P_BOOL, P_GLOBAL, &Globals.bWINSsupport, NULL, NULL},
|
||||
{"wins proxy", P_BOOL, P_GLOBAL, &Globals.bWINSproxy, NULL, NULL},
|
||||
{"wins server", P_STRING, P_GLOBAL, &Globals.szWINSserver, NULL, NULL},
|
||||
{"preferred master", P_BOOL, P_GLOBAL, &Globals.bPreferredMaster, NULL, NULL},
|
||||
{"prefered master", P_BOOL, P_GLOBAL, &Globals.bPreferredMaster, NULL, NULL},
|
||||
{"local master", P_BOOL, P_GLOBAL, &Globals.bLocalMaster, NULL, NULL},
|
||||
{"domain master", P_BOOL, P_GLOBAL, &Globals.bDomainMaster, NULL, NULL},
|
||||
{"domain logons", P_BOOL, P_GLOBAL, &Globals.bDomainLogons, NULL, NULL},
|
||||
{"browse list", P_BOOL, P_GLOBAL, &Globals.bBrowseList, NULL, NULL},
|
||||
{"unix realname", P_BOOL, P_GLOBAL, &Globals.bUnixRealname, NULL, NULL},
|
||||
{"NIS homedir", P_BOOL, P_GLOBAL, &Globals.bNISHomeMap, NULL, NULL},
|
||||
{"time server", P_BOOL, P_GLOBAL, &Globals.bTimeServer, NULL, NULL},
|
||||
{"printer driver file", P_STRING, P_GLOBAL, &Globals.szDriverFile, NULL, NULL},
|
||||
{"-valid", P_BOOL, P_LOCAL, &sDefault.valid, NULL, NULL},
|
||||
{"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, NULL},
|
||||
{"copy", P_STRING, P_LOCAL, &sDefault.szCopy, handle_copy, NULL},
|
||||
{"include", P_STRING, P_LOCAL, &sDefault.szInclude, handle_include, NULL},
|
||||
{"exec", P_STRING, P_LOCAL, &sDefault.szPreExec, NULL, NULL},
|
||||
{"preexec", P_STRING, P_LOCAL, &sDefault.szPreExec, NULL, NULL},
|
||||
{"postexec", P_STRING, P_LOCAL, &sDefault.szPostExec, NULL, NULL},
|
||||
{"root preexec", P_STRING, P_LOCAL, &sDefault.szRootPreExec, NULL, NULL},
|
||||
{"root postexec", P_STRING, P_LOCAL, &sDefault.szRootPostExec, NULL, NULL},
|
||||
{"alternate permissions",P_BOOL,P_LOCAL, &sDefault.bAlternatePerm, NULL, NULL},
|
||||
{"revalidate", P_BOOL, P_LOCAL, &sDefault.bRevalidate, NULL, NULL},
|
||||
{"default case", P_ENUM, P_LOCAL, &sDefault.iDefaultCase, NULL, enum_case},
|
||||
{"case sensitive", P_BOOL, P_LOCAL, &sDefault.bCaseSensitive, NULL, NULL},
|
||||
{"casesignames", P_BOOL, P_LOCAL, &sDefault.bCaseSensitive, NULL, NULL},
|
||||
{"preserve case", P_BOOL, P_LOCAL, &sDefault.bCasePreserve, NULL, NULL},
|
||||
{"short preserve case",P_BOOL, P_LOCAL, &sDefault.bShortCasePreserve,NULL, NULL},
|
||||
{"mangle case", P_BOOL, P_LOCAL, &sDefault.bCaseMangle, NULL, NULL},
|
||||
{"mangling char", P_CHAR, P_LOCAL, &sDefault.magic_char, NULL, NULL},
|
||||
{"browseable", P_BOOL, P_LOCAL, &sDefault.bBrowseable, NULL, NULL},
|
||||
{"browsable", P_BOOL, P_LOCAL, &sDefault.bBrowseable, NULL, NULL},
|
||||
{"available", P_BOOL, P_LOCAL, &sDefault.bAvailable, NULL, NULL},
|
||||
{"path", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL},
|
||||
{"directory", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL},
|
||||
{"username", P_STRING, P_LOCAL, &sDefault.szUsername, NULL, NULL},
|
||||
{"user", P_STRING, P_LOCAL, &sDefault.szUsername, NULL, NULL},
|
||||
{"users", P_STRING, P_LOCAL, &sDefault.szUsername, NULL, NULL},
|
||||
{"guest account", P_STRING, P_LOCAL, &sDefault.szGuestaccount, NULL, NULL},
|
||||
{"invalid users", P_STRING, P_LOCAL, &sDefault.szInvalidUsers, NULL, NULL},
|
||||
{"valid users", P_STRING, P_LOCAL, &sDefault.szValidUsers, NULL, NULL},
|
||||
{"admin users", P_STRING, P_LOCAL, &sDefault.szAdminUsers, NULL, NULL},
|
||||
{"read list", P_STRING, P_LOCAL, &sDefault.readlist, NULL, NULL},
|
||||
{"write list", P_STRING, P_LOCAL, &sDefault.writelist, NULL, NULL},
|
||||
{"volume", P_STRING, P_LOCAL, &sDefault.volume, NULL, NULL},
|
||||
{"force user", P_STRING, P_LOCAL, &sDefault.force_user, NULL, NULL},
|
||||
{"force group", P_STRING, P_LOCAL, &sDefault.force_group, NULL, NULL},
|
||||
{"group", P_STRING, P_LOCAL, &sDefault.force_group, NULL, NULL},
|
||||
{"read only", P_BOOL, P_LOCAL, &sDefault.bRead_only, NULL, NULL},
|
||||
{"write ok", P_BOOLREV, P_LOCAL, &sDefault.bRead_only, NULL, NULL},
|
||||
{"writeable", P_BOOLREV, P_LOCAL, &sDefault.bRead_only, NULL, NULL},
|
||||
{"writable", P_BOOLREV, P_LOCAL, &sDefault.bRead_only, NULL, NULL},
|
||||
{"max connections", P_INTEGER, P_LOCAL, &sDefault.iMaxConnections, NULL, NULL},
|
||||
{"min print space", P_INTEGER, P_LOCAL, &sDefault.iMinPrintSpace, NULL, NULL},
|
||||
{"create mask", P_OCTAL, P_LOCAL, &sDefault.iCreate_mask, NULL, NULL},
|
||||
{"create mode", P_OCTAL, P_LOCAL, &sDefault.iCreate_mask, NULL, NULL},
|
||||
{"force create mode",P_OCTAL, P_LOCAL, &sDefault.iCreate_force_mode, NULL, NULL},
|
||||
{"directory mask", P_OCTAL, P_LOCAL, &sDefault.iDir_mask, NULL, NULL},
|
||||
{"directory mode", P_OCTAL, P_LOCAL, &sDefault.iDir_mask, NULL, NULL},
|
||||
{"force directory mode", P_OCTAL, P_LOCAL, &sDefault.iDir_force_mode, NULL, NULL},
|
||||
{"set directory", P_BOOLREV, P_LOCAL, &sDefault.bNo_set_dir, NULL, NULL},
|
||||
{"status", P_BOOL, P_LOCAL, &sDefault.status, NULL, NULL},
|
||||
{"hide dot files", P_BOOL, P_LOCAL, &sDefault.bHideDotFiles, NULL, NULL},
|
||||
{"delete veto files",P_BOOL, P_LOCAL, &sDefault.bDeleteVetoFiles, NULL, NULL},
|
||||
{"veto files", P_STRING, P_LOCAL, &sDefault.szVetoFiles, NULL, NULL},
|
||||
{"hide files", P_STRING, P_LOCAL, &sDefault.szHideFiles, NULL, NULL},
|
||||
{"veto oplock files",P_STRING, P_LOCAL, &sDefault.szVetoOplockFiles,NULL, NULL},
|
||||
{"guest only", P_BOOL, P_LOCAL, &sDefault.bGuest_only, NULL, NULL},
|
||||
{"only guest", P_BOOL, P_LOCAL, &sDefault.bGuest_only, NULL, NULL},
|
||||
{"guest ok", P_BOOL, P_LOCAL, &sDefault.bGuest_ok, NULL, NULL},
|
||||
{"public", P_BOOL, P_LOCAL, &sDefault.bGuest_ok, NULL, NULL},
|
||||
{"print ok", P_BOOL, P_LOCAL, &sDefault.bPrint_ok, NULL, NULL},
|
||||
{"printable", P_BOOL, P_LOCAL, &sDefault.bPrint_ok, NULL, NULL},
|
||||
{"postscript", P_BOOL, P_LOCAL, &sDefault.bPostscript, NULL, NULL},
|
||||
{"map system", P_BOOL, P_LOCAL, &sDefault.bMap_system, NULL, NULL},
|
||||
{"map hidden", P_BOOL, P_LOCAL, &sDefault.bMap_hidden, NULL, NULL},
|
||||
{"map archive", P_BOOL, P_LOCAL, &sDefault.bMap_archive, NULL, NULL},
|
||||
{"locking", P_BOOL, P_LOCAL, &sDefault.bLocking, NULL, NULL},
|
||||
{"strict locking", P_BOOL, P_LOCAL, &sDefault.bStrictLocking, NULL, NULL},
|
||||
{"share modes", P_BOOL, P_LOCAL, &sDefault.bShareModes, NULL, NULL},
|
||||
{"oplocks", P_BOOL, P_LOCAL, &sDefault.bOpLocks, NULL, NULL},
|
||||
{"only user", P_BOOL, P_LOCAL, &sDefault.bOnlyUser, NULL, NULL},
|
||||
{"wide links", P_BOOL, P_LOCAL, &sDefault.bWidelinks, NULL, NULL},
|
||||
{"follow symlinks", P_BOOL, P_LOCAL, &sDefault.bSymlinks, NULL, NULL},
|
||||
{"sync always", P_BOOL, P_LOCAL, &sDefault.bSyncAlways, NULL, NULL},
|
||||
{"mangled names", P_BOOL, P_LOCAL, &sDefault.bMangledNames, NULL, NULL},
|
||||
{"fake oplocks", P_BOOL, P_LOCAL, &sDefault.bFakeOplocks, NULL, NULL},
|
||||
{"printing", P_ENUM, P_LOCAL, &sDefault.iPrinting, NULL, enum_printing},
|
||||
{"print command", P_STRING, P_LOCAL, &sDefault.szPrintcommand, NULL, NULL},
|
||||
{"lpq command", P_STRING, P_LOCAL, &sDefault.szLpqcommand, NULL, NULL},
|
||||
{"lprm command", P_STRING, P_LOCAL, &sDefault.szLprmcommand, NULL, NULL},
|
||||
{"lppause command", P_STRING, P_LOCAL, &sDefault.szLppausecommand, NULL, NULL},
|
||||
{"lpresume command", P_STRING, P_LOCAL, &sDefault.szLpresumecommand,NULL, NULL},
|
||||
{"printer", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL},
|
||||
{"printer name", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL},
|
||||
{"printer driver", P_STRING, P_LOCAL, &sDefault.szPrinterDriver, NULL, NULL},
|
||||
{"printer driver location", P_STRING, P_LOCAL, &sDefault.szPrinterDriverLocation, NULL, NULL},
|
||||
{"hosts allow", P_STRING, P_LOCAL, &sDefault.szHostsallow, NULL, NULL},
|
||||
{"allow hosts", P_STRING, P_LOCAL, &sDefault.szHostsallow, NULL, NULL},
|
||||
{"hosts deny", P_STRING, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL},
|
||||
{"deny hosts", P_STRING, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL},
|
||||
{"dont descend", P_STRING, P_LOCAL, &sDefault.szDontdescend, NULL, NULL},
|
||||
{"magic script", P_STRING, P_LOCAL, &sDefault.szMagicScript, NULL, NULL},
|
||||
{"magic output", P_STRING, P_LOCAL, &sDefault.szMagicOutput, NULL, NULL},
|
||||
{"mangled map", P_STRING, P_LOCAL, &sDefault.szMangledMap, NULL, NULL},
|
||||
{"delete readonly", P_BOOL, P_LOCAL, &sDefault.bDeleteReadonly, NULL, NULL},
|
||||
{"dos filetimes", P_BOOL, P_LOCAL, &sDefault.bDosFiletimes, NULL, NULL},
|
||||
{"dos filetime resolution", P_BOOL, P_LOCAL, &sDefault.bDosFiletimeResolution, NULL, NULL},
|
||||
{"username map", P_STRING, P_GLOBAL, &Globals.szUsernameMap, NULL, NULL, 0},
|
||||
{"character set", P_STRING, P_GLOBAL, &Globals.szCharacterSet, handle_character_set, NULL, 0},
|
||||
{"logon script", P_STRING, P_GLOBAL, &Globals.szLogonScript, NULL, NULL, 0},
|
||||
{"logon path", P_STRING, P_GLOBAL, &Globals.szLogonPath, NULL, NULL, 0},
|
||||
{"logon drive", P_STRING, P_GLOBAL, &Globals.szLogonDrive, NULL, NULL, 0},
|
||||
{"logon home", P_STRING, P_GLOBAL, &Globals.szLogonHome, NULL, NULL, 0},
|
||||
{"remote announce", P_STRING, P_GLOBAL, &Globals.szRemoteAnnounce, NULL, NULL, 0},
|
||||
{"remote browse sync",P_STRING, P_GLOBAL, &Globals.szRemoteBrowseSync,NULL, NULL, 0},
|
||||
{"socket address", P_STRING, P_GLOBAL, &Globals.szSocketAddress, NULL, NULL, 0},
|
||||
{"homedir map", P_STRING, P_GLOBAL, &Globals.szNISHomeMapName, NULL, NULL, 0},
|
||||
{"announce version", P_STRING, P_GLOBAL, &Globals.szAnnounceVersion, NULL, NULL, 0},
|
||||
{"max log size", P_INTEGER, P_GLOBAL, &Globals.max_log_size, NULL, NULL, 0},
|
||||
{"mangled stack", P_INTEGER, P_GLOBAL, &Globals.mangled_stack, NULL, NULL, 0},
|
||||
{"max mux", P_INTEGER, P_GLOBAL, &Globals.max_mux, NULL, NULL, 0},
|
||||
{"max xmit", P_INTEGER, P_GLOBAL, &Globals.max_xmit, NULL, NULL, 0},
|
||||
{"max packet", P_INTEGER, P_GLOBAL, &Globals.max_packet, NULL, NULL, 0},
|
||||
{"packet size", P_INTEGER, P_GLOBAL, &Globals.max_packet, NULL, NULL, 0},
|
||||
{"password level", P_INTEGER, P_GLOBAL, &Globals.pwordlevel, NULL, NULL, 0},
|
||||
{"username level", P_INTEGER, P_GLOBAL, &Globals.unamelevel, NULL, NULL, 0},
|
||||
{"keepalive", P_INTEGER, P_GLOBAL, &keepalive, NULL, NULL, 0},
|
||||
{"deadtime", P_INTEGER, P_GLOBAL, &Globals.deadtime, NULL, NULL, 0},
|
||||
{"time offset", P_INTEGER, P_GLOBAL, &extra_time_offset, NULL, NULL, 0},
|
||||
{"read size", P_INTEGER, P_GLOBAL, &Globals.ReadSize, NULL, NULL, 0},
|
||||
{"shared mem size", P_INTEGER, P_GLOBAL, &Globals.shmem_size, NULL, NULL, 0},
|
||||
{"coding system", P_STRING, P_GLOBAL, &Globals.szCodingSystem, handle_coding_system, NULL, 0},
|
||||
{"client code page", P_INTEGER, P_GLOBAL, &Globals.client_code_page, NULL, NULL, 0},
|
||||
{"os level", P_INTEGER, P_GLOBAL, &Globals.os_level, NULL, NULL, 0},
|
||||
{"max ttl", P_INTEGER, P_GLOBAL, &Globals.max_ttl, NULL, NULL, 0},
|
||||
{"max wins ttl", P_INTEGER, P_GLOBAL, &Globals.max_wins_ttl, NULL, NULL, 0},
|
||||
{"min wins ttl", P_INTEGER, P_GLOBAL, &Globals.min_wins_ttl, NULL, NULL, 0},
|
||||
{"lm announce", P_ENUM, P_GLOBAL, &Globals.lm_announce, NULL, enum_lm_announce, 0},
|
||||
{"lm interval", P_INTEGER, P_GLOBAL, &Globals.lm_interval, NULL, NULL, 0},
|
||||
{"dns proxy", P_BOOL, P_GLOBAL, &Globals.bDNSproxy, NULL, NULL, 0},
|
||||
{"wins support", P_BOOL, P_GLOBAL, &Globals.bWINSsupport, NULL, NULL, FLAG_BASIC},
|
||||
{"wins proxy", P_BOOL, P_GLOBAL, &Globals.bWINSproxy, NULL, NULL, 0},
|
||||
{"wins server", P_STRING, P_GLOBAL, &Globals.szWINSserver, NULL, NULL, FLAG_BASIC},
|
||||
{"preferred master", P_BOOL, P_GLOBAL, &Globals.bPreferredMaster, NULL, NULL, 0},
|
||||
{"prefered master", P_BOOL, P_GLOBAL, &Globals.bPreferredMaster, NULL, NULL, 0},
|
||||
{"local master", P_BOOL, P_GLOBAL, &Globals.bLocalMaster, NULL, NULL, 0},
|
||||
{"domain master", P_BOOL, P_GLOBAL, &Globals.bDomainMaster, NULL, NULL, 0},
|
||||
{"domain logons", P_BOOL, P_GLOBAL, &Globals.bDomainLogons, NULL, NULL, 0},
|
||||
{"browse list", P_BOOL, P_GLOBAL, &Globals.bBrowseList, NULL, NULL, 0},
|
||||
{"unix realname", P_BOOL, P_GLOBAL, &Globals.bUnixRealname, NULL, NULL, 0},
|
||||
{"NIS homedir", P_BOOL, P_GLOBAL, &Globals.bNISHomeMap, NULL, NULL, 0},
|
||||
{"time server", P_BOOL, P_GLOBAL, &Globals.bTimeServer, NULL, NULL, 0},
|
||||
{"printer driver file", P_STRING, P_GLOBAL, &Globals.szDriverFile, NULL, NULL, 0},
|
||||
{"-valid", P_BOOL, P_LOCAL, &sDefault.valid, NULL, NULL, FLAG_HIDE},
|
||||
{"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, NULL, FLAG_BASIC|FLAG_PRINT},
|
||||
{"copy", P_STRING, P_LOCAL, &sDefault.szCopy, handle_copy, NULL, FLAG_HIDE},
|
||||
{"include", P_STRING, P_LOCAL, &sDefault.szInclude, handle_include, NULL, FLAG_HIDE},
|
||||
{"exec", P_STRING, P_LOCAL, &sDefault.szPreExec, NULL, NULL, 0},
|
||||
{"preexec", P_STRING, P_LOCAL, &sDefault.szPreExec, NULL, NULL, 0},
|
||||
{"postexec", P_STRING, P_LOCAL, &sDefault.szPostExec, NULL, NULL, 0},
|
||||
{"root preexec", P_STRING, P_LOCAL, &sDefault.szRootPreExec, NULL, NULL, 0},
|
||||
{"root postexec", P_STRING, P_LOCAL, &sDefault.szRootPostExec, NULL, NULL, 0},
|
||||
{"alternate permissions",P_BOOL,P_LOCAL, &sDefault.bAlternatePerm, NULL, NULL, 0},
|
||||
{"revalidate", P_BOOL, P_LOCAL, &sDefault.bRevalidate, NULL, NULL, 0},
|
||||
{"default case", P_ENUM, P_LOCAL, &sDefault.iDefaultCase, NULL, enum_case, 0},
|
||||
{"case sensitive", P_BOOL, P_LOCAL, &sDefault.bCaseSensitive, NULL, NULL, 0},
|
||||
{"casesignames", P_BOOL, P_LOCAL, &sDefault.bCaseSensitive, NULL, NULL, 0},
|
||||
{"preserve case", P_BOOL, P_LOCAL, &sDefault.bCasePreserve, NULL, NULL, 0},
|
||||
{"short preserve case",P_BOOL, P_LOCAL, &sDefault.bShortCasePreserve,NULL, NULL, 0},
|
||||
{"mangle case", P_BOOL, P_LOCAL, &sDefault.bCaseMangle, NULL, NULL, 0},
|
||||
{"mangling char", P_CHAR, P_LOCAL, &sDefault.magic_char, NULL, NULL, 0},
|
||||
{"browseable", P_BOOL, P_LOCAL, &sDefault.bBrowseable, NULL, NULL, 0},
|
||||
{"browsable", P_BOOL, P_LOCAL, &sDefault.bBrowseable, NULL, NULL, 0},
|
||||
{"available", P_BOOL, P_LOCAL, &sDefault.bAvailable, NULL, NULL, 0},
|
||||
{"path", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_BASIC|FLAG_PRINT},
|
||||
{"directory", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, 0},
|
||||
{"username", P_STRING, P_LOCAL, &sDefault.szUsername, NULL, NULL, 0},
|
||||
{"user", P_STRING, P_LOCAL, &sDefault.szUsername, NULL, NULL, 0},
|
||||
{"users", P_STRING, P_LOCAL, &sDefault.szUsername, NULL, NULL, 0},
|
||||
{"guest account", P_STRING, P_LOCAL, &sDefault.szGuestaccount, NULL, NULL, FLAG_BASIC|FLAG_PRINT},
|
||||
{"invalid users", P_STRING, P_LOCAL, &sDefault.szInvalidUsers, NULL, NULL, 0},
|
||||
{"valid users", P_STRING, P_LOCAL, &sDefault.szValidUsers, NULL, NULL, 0},
|
||||
{"admin users", P_STRING, P_LOCAL, &sDefault.szAdminUsers, NULL, NULL, 0},
|
||||
{"read list", P_STRING, P_LOCAL, &sDefault.readlist, NULL, NULL, 0},
|
||||
{"write list", P_STRING, P_LOCAL, &sDefault.writelist, NULL, NULL, 0},
|
||||
{"volume", P_STRING, P_LOCAL, &sDefault.volume, NULL, NULL, 0},
|
||||
{"force user", P_STRING, P_LOCAL, &sDefault.force_user, NULL, NULL, 0},
|
||||
{"force group", P_STRING, P_LOCAL, &sDefault.force_group, NULL, NULL, 0},
|
||||
{"group", P_STRING, P_LOCAL, &sDefault.force_group, NULL, NULL, 0},
|
||||
{"read only", P_BOOL, P_LOCAL, &sDefault.bRead_only, NULL, NULL, FLAG_BASIC},
|
||||
{"write ok", P_BOOLREV, P_LOCAL, &sDefault.bRead_only, NULL, NULL, 0},
|
||||
{"writeable", P_BOOLREV, P_LOCAL, &sDefault.bRead_only, NULL, NULL, 0},
|
||||
{"writable", P_BOOLREV, P_LOCAL, &sDefault.bRead_only, NULL, NULL, 0},
|
||||
{"max connections", P_INTEGER, P_LOCAL, &sDefault.iMaxConnections, NULL, NULL, 0},
|
||||
{"min print space", P_INTEGER, P_LOCAL, &sDefault.iMinPrintSpace, NULL, NULL, 0},
|
||||
{"create mask", P_OCTAL, P_LOCAL, &sDefault.iCreate_mask, NULL, NULL, 0},
|
||||
{"create mode", P_OCTAL, P_LOCAL, &sDefault.iCreate_mask, NULL, NULL, 0},
|
||||
{"force create mode",P_OCTAL, P_LOCAL, &sDefault.iCreate_force_mode, NULL, NULL, 0},
|
||||
{"directory mask", P_OCTAL, P_LOCAL, &sDefault.iDir_mask, NULL, NULL, 0},
|
||||
{"directory mode", P_OCTAL, P_LOCAL, &sDefault.iDir_mask, NULL, NULL, 0},
|
||||
{"force directory mode", P_OCTAL, P_LOCAL, &sDefault.iDir_force_mode, NULL, NULL, 0},
|
||||
{"set directory", P_BOOLREV, P_LOCAL, &sDefault.bNo_set_dir, NULL, NULL, 0},
|
||||
{"status", P_BOOL, P_LOCAL, &sDefault.status, NULL, NULL, 0},
|
||||
{"hide dot files", P_BOOL, P_LOCAL, &sDefault.bHideDotFiles, NULL, NULL, 0},
|
||||
{"delete veto files",P_BOOL, P_LOCAL, &sDefault.bDeleteVetoFiles, NULL, NULL, 0},
|
||||
{"veto files", P_STRING, P_LOCAL, &sDefault.szVetoFiles, NULL, NULL, 0},
|
||||
{"hide files", P_STRING, P_LOCAL, &sDefault.szHideFiles, NULL, NULL, 0},
|
||||
{"veto oplock files",P_STRING, P_LOCAL, &sDefault.szVetoOplockFiles,NULL, NULL, 0},
|
||||
{"guest only", P_BOOL, P_LOCAL, &sDefault.bGuest_only, NULL, NULL, 0},
|
||||
{"only guest", P_BOOL, P_LOCAL, &sDefault.bGuest_only, NULL, NULL, 0},
|
||||
{"guest ok", P_BOOL, P_LOCAL, &sDefault.bGuest_ok, NULL, NULL, FLAG_BASIC|FLAG_PRINT},
|
||||
{"public", P_BOOL, P_LOCAL, &sDefault.bGuest_ok, NULL, NULL, 0},
|
||||
{"print ok", P_BOOL, P_LOCAL, &sDefault.bPrint_ok, NULL, NULL, 0},
|
||||
{"printable", P_BOOL, P_LOCAL, &sDefault.bPrint_ok, NULL, NULL, 0},
|
||||
{"postscript", P_BOOL, P_LOCAL, &sDefault.bPostscript, NULL, NULL, FLAG_PRINT},
|
||||
{"map system", P_BOOL, P_LOCAL, &sDefault.bMap_system, NULL, NULL, 0},
|
||||
{"map hidden", P_BOOL, P_LOCAL, &sDefault.bMap_hidden, NULL, NULL, 0},
|
||||
{"map archive", P_BOOL, P_LOCAL, &sDefault.bMap_archive, NULL, NULL, 0},
|
||||
{"locking", P_BOOL, P_LOCAL, &sDefault.bLocking, NULL, NULL, 0},
|
||||
{"strict locking", P_BOOL, P_LOCAL, &sDefault.bStrictLocking, NULL, NULL, 0},
|
||||
{"share modes", P_BOOL, P_LOCAL, &sDefault.bShareModes, NULL, NULL, 0},
|
||||
{"oplocks", P_BOOL, P_LOCAL, &sDefault.bOpLocks, NULL, NULL, 0},
|
||||
{"only user", P_BOOL, P_LOCAL, &sDefault.bOnlyUser, NULL, NULL, 0},
|
||||
{"wide links", P_BOOL, P_LOCAL, &sDefault.bWidelinks, NULL, NULL, 0},
|
||||
{"follow symlinks", P_BOOL, P_LOCAL, &sDefault.bSymlinks, NULL, NULL, 0},
|
||||
{"sync always", P_BOOL, P_LOCAL, &sDefault.bSyncAlways, NULL, NULL, 0},
|
||||
{"mangled names", P_BOOL, P_LOCAL, &sDefault.bMangledNames, NULL, NULL, 0},
|
||||
{"fake oplocks", P_BOOL, P_LOCAL, &sDefault.bFakeOplocks, NULL, NULL, 0},
|
||||
{"printing", P_ENUM, P_LOCAL, &sDefault.iPrinting, NULL, enum_printing, FLAG_PRINT},
|
||||
{"print command", P_STRING, P_LOCAL, &sDefault.szPrintcommand, NULL, NULL, FLAG_PRINT},
|
||||
{"lpq command", P_STRING, P_LOCAL, &sDefault.szLpqcommand, NULL, NULL, FLAG_PRINT},
|
||||
{"lprm command", P_STRING, P_LOCAL, &sDefault.szLprmcommand, NULL, NULL, FLAG_PRINT},
|
||||
{"lppause command", P_STRING, P_LOCAL, &sDefault.szLppausecommand, NULL, NULL, 0},
|
||||
{"lpresume command", P_STRING, P_LOCAL, &sDefault.szLpresumecommand,NULL, NULL, 0},
|
||||
{"printer name", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_PRINT},
|
||||
{"printer", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, 0},
|
||||
{"printer driver", P_STRING, P_LOCAL, &sDefault.szPrinterDriver, NULL, NULL, 0},
|
||||
{"printer driver location", P_STRING, P_LOCAL, &sDefault.szPrinterDriverLocation, NULL, NULL, 0},
|
||||
{"hosts allow", P_STRING, P_LOCAL, &sDefault.szHostsallow, NULL, NULL, FLAG_BASIC|FLAG_PRINT},
|
||||
{"allow hosts", P_STRING, P_LOCAL, &sDefault.szHostsallow, NULL, NULL, 0},
|
||||
{"hosts deny", P_STRING, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_BASIC|FLAG_PRINT},
|
||||
{"deny hosts", P_STRING, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, 0},
|
||||
{"dont descend", P_STRING, P_LOCAL, &sDefault.szDontdescend, NULL, NULL, 0},
|
||||
{"magic script", P_STRING, P_LOCAL, &sDefault.szMagicScript, NULL, NULL, 0},
|
||||
{"magic output", P_STRING, P_LOCAL, &sDefault.szMagicOutput, NULL, NULL, 0},
|
||||
{"mangled map", P_STRING, P_LOCAL, &sDefault.szMangledMap, NULL, NULL, 0},
|
||||
{"delete readonly", P_BOOL, P_LOCAL, &sDefault.bDeleteReadonly, NULL, NULL, 0},
|
||||
{"dos filetimes", P_BOOL, P_LOCAL, &sDefault.bDosFiletimes, NULL, NULL, 0},
|
||||
{"dos filetime resolution", P_BOOL, P_LOCAL, &sDefault.bDosFiletimeResolution, NULL, NULL, 0},
|
||||
|
||||
{NULL, P_BOOL, P_NONE, NULL, NULL, NULL}
|
||||
{NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
|
||||
@ -1663,6 +1638,15 @@ static void init_copymap(service *pservice)
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
return the local pointer to a parameter given the service number and the
|
||||
pointer into the default structure
|
||||
***************************************************************************/
|
||||
void *lp_local_ptr(int snum, void *ptr)
|
||||
{
|
||||
return (void *)(((char *)pSERVICE(snum)) + PTR_DIFF(ptr,&sDefault));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
Process a parameter for a particular service number. If snum < 0
|
||||
then assume we are in the globals
|
||||
@ -1830,59 +1814,6 @@ static void print_parameter(struct parm_struct *p,void *ptr, FILE *f)
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
print a parameter of the specified type
|
||||
***************************************************************************/
|
||||
static void parameter_string(struct parm_struct *p,void *ptr,char *s)
|
||||
{
|
||||
int i;
|
||||
s[0] = 0;
|
||||
|
||||
switch (p->type) {
|
||||
case P_ENUM:
|
||||
for (i=0;p->enum_list[i].name;i++) {
|
||||
if (*(int *)ptr == p->enum_list[i].value) {
|
||||
sprintf(s,"%s",p->enum_list[i].name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case P_BOOL:
|
||||
sprintf(s, "%s",BOOLSTR(*(BOOL *)ptr));
|
||||
break;
|
||||
|
||||
case P_BOOLREV:
|
||||
sprintf(s, "%s",BOOLSTR(! *(BOOL *)ptr));
|
||||
break;
|
||||
|
||||
case P_INTEGER:
|
||||
sprintf(s, "%d",*(int *)ptr);
|
||||
break;
|
||||
|
||||
case P_CHAR:
|
||||
sprintf(s, "%c",*(char *)ptr);
|
||||
break;
|
||||
|
||||
case P_OCTAL:
|
||||
sprintf(s, "0%o",*(int *)ptr);
|
||||
break;
|
||||
|
||||
case P_GSTRING:
|
||||
case P_UGSTRING:
|
||||
if ((char *)ptr)
|
||||
sprintf(s, "%s",(char *)ptr);
|
||||
break;
|
||||
|
||||
case P_STRING:
|
||||
case P_USTRING:
|
||||
if (*(char **)ptr)
|
||||
sprintf(s, "%s",*(char **)ptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
check if two parameters are equal
|
||||
***************************************************************************/
|
||||
@ -2030,8 +1961,7 @@ serice and snum==-2 gives the globals
|
||||
|
||||
return 0 when out of parameters
|
||||
***************************************************************************/
|
||||
int lp_next_parameter(int snum, int *i, char *label,
|
||||
char *value, int allparameters)
|
||||
struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
|
||||
{
|
||||
if (snum == -2) {
|
||||
/* do the globals */
|
||||
@ -2041,12 +1971,7 @@ int lp_next_parameter(int snum, int *i, char *label,
|
||||
(*parm_table[*i].label != '-') &&
|
||||
((*i) == 0 ||
|
||||
(parm_table[*i].ptr != parm_table[(*i)-1].ptr))) {
|
||||
strcpy(label, parm_table[*i].label);
|
||||
parameter_string(&parm_table[*i],
|
||||
parm_table[*i].ptr,
|
||||
value);
|
||||
(*i)++;
|
||||
return 1;
|
||||
return &parm_table[(*i)++];
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
@ -2064,12 +1989,7 @@ int lp_next_parameter(int snum, int *i, char *label,
|
||||
!equal_parameter(parm_table[*i].type,
|
||||
((char *)pService) + pdiff,
|
||||
((char *)&sDefault) + pdiff)) {
|
||||
strcpy(label, parm_table[*i].label);
|
||||
parameter_string(&parm_table[*i],
|
||||
((char *)pService) + pdiff,
|
||||
value);
|
||||
(*i)++;
|
||||
return 1;
|
||||
return &parm_table[(*i)++];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
483
source3/swat.c
Normal file
483
source3/swat.c
Normal file
@ -0,0 +1,483 @@
|
||||
/*
|
||||
Unix SMB/Netbios implementation.
|
||||
Version 1.9.
|
||||
html smb.conf editing - prototype only
|
||||
Copyright (C) Andrew Tridgell 1997-1998
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifdef SYSLOG
|
||||
#undef SYSLOG
|
||||
#endif
|
||||
|
||||
#include "includes.h"
|
||||
#include "smb.h"
|
||||
|
||||
#define GLOBALS_SNUM -2
|
||||
#define DEFAULTS_SNUM -1
|
||||
|
||||
static pstring servicesf = CONFIGFILE;
|
||||
|
||||
|
||||
/* start the page with standard stuff */
|
||||
static void print_header(void)
|
||||
{
|
||||
printf("Content-type: text/html\r\n\r\n");
|
||||
printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n");
|
||||
printf("<HTML>\n<HEAD>\n<TITLE>Samba Web Administration Tool</TITLE>\n</HEAD>\n<BODY>\n\n");
|
||||
}
|
||||
|
||||
|
||||
/* finish off the page */
|
||||
static void print_footer(void)
|
||||
{
|
||||
printf("\n</BODY>\n</HTML>\n");
|
||||
}
|
||||
|
||||
/* include a lump of html in a page */
|
||||
static void include_html(char *fname)
|
||||
{
|
||||
FILE *f = fopen(fname,"r");
|
||||
char buf[1024];
|
||||
int ret;
|
||||
|
||||
if (!f) {
|
||||
printf("ERROR: Can't open %s\n", fname);
|
||||
return;
|
||||
}
|
||||
|
||||
while (!feof(f)) {
|
||||
ret = fread(buf, 1, sizeof(buf), f);
|
||||
if (ret <= 0) break;
|
||||
fwrite(buf, 1, ret, stdout);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
||||
/* display one editable parameter */
|
||||
static void show_parameter(int snum, struct parm_struct *parm)
|
||||
{
|
||||
int i;
|
||||
void *ptr = parm->ptr;
|
||||
|
||||
if (parm->class == P_LOCAL) {
|
||||
ptr = lp_local_ptr(snum, ptr);
|
||||
}
|
||||
|
||||
printf("<tr><td><A HREF=\"help/parameters.html#%s\">?</A> %s</td><td>",
|
||||
parm->label, parm->label);
|
||||
|
||||
switch (parm->type) {
|
||||
case P_CHAR:
|
||||
printf("<input type=text size=2 name=\"parm_%s\" value=\"%c\">",
|
||||
parm->label, *(char *)ptr);
|
||||
break;
|
||||
|
||||
case P_STRING:
|
||||
case P_USTRING:
|
||||
printf("<input type=text size=40 name=\"parm_%s\" value=\"%s\">",
|
||||
parm->label, *(char **)ptr);
|
||||
break;
|
||||
|
||||
case P_GSTRING:
|
||||
case P_UGSTRING:
|
||||
printf("<input type=text size=40 name=\"parm_%s\" value=\"%s\">",
|
||||
parm->label, (char *)ptr);
|
||||
break;
|
||||
|
||||
case P_BOOL:
|
||||
printf("<input type=radio name=\"parm_%s\" value=Yes %s>yes ", parm->label, (*(BOOL *)ptr)?"CHECKED":"");
|
||||
printf("<input type=radio name=\"parm_%s\" value=No %s>no", parm->label, (*(BOOL *)ptr)?"":"CHECKED");
|
||||
break;
|
||||
|
||||
case P_BOOLREV:
|
||||
printf("<input type=radio name=\"parm_%s\" value=Yes %s>yes ", parm->label, (*(BOOL *)ptr)?"":"CHECKED");
|
||||
printf("<input type=radio name=\"parm_%s\" value=No %s>no", parm->label, (*(BOOL *)ptr)?"CHECKED":"");
|
||||
break;
|
||||
|
||||
case P_INTEGER:
|
||||
printf("<input type=text size=8 name=\"parm_%s\" value=%d>", parm->label, *(int *)ptr);
|
||||
break;
|
||||
|
||||
case P_OCTAL:
|
||||
printf("<input type=text size=8 name=\"parm_%s\" value=0%o>", parm->label, *(int *)ptr);
|
||||
break;
|
||||
|
||||
case P_ENUM:
|
||||
for (i=0;parm->enum_list[i].name;i++)
|
||||
printf("<input type=radio name=\"parm_%s\" value=%s %s>%s ",
|
||||
parm->label, parm->enum_list[i].name,
|
||||
(*(int *)ptr)==parm->enum_list[i].value?"CHECKED":"",
|
||||
parm->enum_list[i].name);
|
||||
break;
|
||||
|
||||
}
|
||||
printf("</td></tr>\n");
|
||||
}
|
||||
|
||||
/* display a set of parameters for a service */
|
||||
static void show_parameters(int snum, int allparameters, int advanced, int printers)
|
||||
{
|
||||
int i = 0;
|
||||
struct parm_struct *parm;
|
||||
|
||||
printf("<table>\n");
|
||||
|
||||
while ((parm = lp_next_parameter(snum, &i, allparameters))) {
|
||||
if (parm->flags & FLAG_HIDE) continue;
|
||||
if (!advanced) {
|
||||
if (!printers && !(parm->flags & FLAG_BASIC)) continue;
|
||||
if (printers && !(parm->flags & FLAG_PRINT)) continue;
|
||||
}
|
||||
show_parameter(snum, parm);
|
||||
}
|
||||
printf("</table>\n");
|
||||
}
|
||||
|
||||
|
||||
static int save_reload(void)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
f = fopen(servicesf,"w");
|
||||
if (!f) {
|
||||
printf("failed to open %s for writing\n", servicesf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fprintf(f, "# Samba config file created using SWAT\n");
|
||||
|
||||
lp_dump(f);
|
||||
|
||||
fclose(f);
|
||||
|
||||
lp_killunused(NULL);
|
||||
|
||||
if (!lp_load(servicesf,False)) {
|
||||
printf("Can't reload %s\n", servicesf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* commit a set of parameters for a service */
|
||||
static void commit_parameters(int snum)
|
||||
{
|
||||
int i = 0;
|
||||
struct parm_struct *parm;
|
||||
pstring label;
|
||||
char *v;
|
||||
|
||||
while ((parm = lp_next_parameter(snum, &i, 1))) {
|
||||
sprintf(label, "parm_%s", parm->label);
|
||||
if ((v = cgi_variable(label))) {
|
||||
lp_do_parameter(snum, parm->label, v);
|
||||
}
|
||||
}
|
||||
|
||||
save_reload();
|
||||
}
|
||||
|
||||
|
||||
/* load the smb.conf file into loadparm. */
|
||||
static void load_config(void)
|
||||
{
|
||||
if (!lp_load(servicesf,False)) {
|
||||
printf("<b>Can't load %s - using defaults</b><p>\n",
|
||||
servicesf);
|
||||
}
|
||||
}
|
||||
|
||||
/* spit out the html for a link with an image */
|
||||
static void image_link(char *name,char *hlink, char *src, int width, int height)
|
||||
{
|
||||
printf("<A HREF=\"%s\"><img width=%d height=%d src=\"%s\" alt=\"%s\"></A>\n", hlink, width, height, src, name);
|
||||
}
|
||||
|
||||
/* display the main navigation controls at the top of each page along
|
||||
with a title */
|
||||
static void show_main_buttons(void)
|
||||
{
|
||||
printf("<H2 align=center>Samba Web Administration Tool</H2>\n");
|
||||
|
||||
image_link("Globals", "globals", "images/globals.gif", 50, 50);
|
||||
image_link("Shares", "shares", "images/shares.gif", 50, 50);
|
||||
image_link("Printers", "printers", "images/printers.gif", 50, 50);
|
||||
|
||||
printf("<HR>\n");
|
||||
}
|
||||
|
||||
/* display a welcome page */
|
||||
static void welcome_page(void)
|
||||
{
|
||||
include_html("help/welcome.html");
|
||||
}
|
||||
|
||||
|
||||
/* display a globals editing page */
|
||||
static void globals_page(void)
|
||||
{
|
||||
int advanced = 0;
|
||||
|
||||
printf("<H2>Global Variables</H2>\n");
|
||||
|
||||
if (cgi_variable("Advanced") && !cgi_variable("Basic"))
|
||||
advanced = 1;
|
||||
|
||||
if (cgi_variable("Commit")) {
|
||||
commit_parameters(GLOBALS_SNUM);
|
||||
}
|
||||
|
||||
printf("<FORM method=post>\n");
|
||||
|
||||
printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
|
||||
if (advanced == 0) {
|
||||
printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
|
||||
} else {
|
||||
printf("<input type=submit name=\"Basic\" value=\"Basic View\">\n");
|
||||
}
|
||||
printf("<p>\n");
|
||||
|
||||
show_parameters(GLOBALS_SNUM, 1, advanced, 0);
|
||||
|
||||
if (advanced) {
|
||||
printf("<input type=hidden name=\"Advanced\" value=1>\n");
|
||||
}
|
||||
|
||||
printf("</form>\n");
|
||||
}
|
||||
|
||||
/* display a shares editing page */
|
||||
static void shares_page(void)
|
||||
{
|
||||
char *share = cgi_variable("share");
|
||||
char *s;
|
||||
int snum=-1;
|
||||
int i;
|
||||
int advanced = 0;
|
||||
|
||||
if (share)
|
||||
snum = lp_servicenumber(share);
|
||||
|
||||
printf("<H2>Share Parameters</H2>\n");
|
||||
|
||||
if (cgi_variable("Advanced") && !cgi_variable("Basic"))
|
||||
advanced = 1;
|
||||
|
||||
if (cgi_variable("Commit") && snum >= 0) {
|
||||
commit_parameters(snum);
|
||||
}
|
||||
|
||||
if (cgi_variable("Delete") && snum >= 0) {
|
||||
lp_remove_service(snum);
|
||||
save_reload();
|
||||
share = NULL;
|
||||
snum = -1;
|
||||
}
|
||||
|
||||
if (cgi_variable("createshare") && (share=cgi_variable("newshare"))) {
|
||||
lp_copy_service(DEFAULTS_SNUM, share);
|
||||
save_reload();
|
||||
snum = lp_servicenumber(share);
|
||||
}
|
||||
|
||||
printf("<FORM method=post>\n");
|
||||
|
||||
printf("<table>\n");
|
||||
printf("<tr><td><input type=submit name=selectshare value=\"Choose Share\"></td>\n");
|
||||
printf("<td><select name=share>\n");
|
||||
if (snum < 0)
|
||||
printf("<option value=\" \"> \n");
|
||||
for (i=0;i<lp_numservices();i++) {
|
||||
s = lp_servicename(i);
|
||||
if (s && (*s) && strcmp(s,"IPC$")) {
|
||||
printf("<option %s value=\"%s\">%s\n",
|
||||
(share && strcmp(share,s)==0)?"SELECTED":"",
|
||||
s, s);
|
||||
}
|
||||
}
|
||||
printf("</select></td></tr><p>");
|
||||
|
||||
printf("<tr><td><input type=submit name=createshare value=\"Create Share\"></td>\n");
|
||||
printf("<td><input type=text size=30 name=newshare></td></tr>\n");
|
||||
printf("</table>");
|
||||
|
||||
|
||||
if (snum >= 0) {
|
||||
printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
|
||||
printf("<input type=submit name=\"Delete\" value=\"Delete Share\">\n");
|
||||
if (advanced == 0) {
|
||||
printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
|
||||
} else {
|
||||
printf("<input type=submit name=\"Basic\" value=\"Basic View\">\n");
|
||||
}
|
||||
printf("<p>\n");
|
||||
}
|
||||
|
||||
if (snum >= 0) {
|
||||
show_parameters(snum, 1, advanced, 0);
|
||||
}
|
||||
|
||||
if (advanced) {
|
||||
printf("<input type=hidden name=\"Advanced\" value=1>\n");
|
||||
}
|
||||
|
||||
printf("</FORM>\n");
|
||||
}
|
||||
|
||||
|
||||
/* display a printers editing page */
|
||||
static void printers_page(void)
|
||||
{
|
||||
char *share = cgi_variable("share");
|
||||
char *s;
|
||||
int snum=-1;
|
||||
int i;
|
||||
int advanced = 0;
|
||||
|
||||
if (share)
|
||||
snum = lp_servicenumber(share);
|
||||
|
||||
printf("<H2>Printer Parameters</H2>\n");
|
||||
|
||||
if (cgi_variable("Advanced") && !cgi_variable("Basic"))
|
||||
advanced = 1;
|
||||
|
||||
if (cgi_variable("Commit") && snum >= 0) {
|
||||
commit_parameters(snum);
|
||||
}
|
||||
|
||||
if (cgi_variable("Delete") && snum >= 0) {
|
||||
lp_remove_service(snum);
|
||||
save_reload();
|
||||
share = NULL;
|
||||
snum = -1;
|
||||
}
|
||||
|
||||
if (cgi_variable("createshare") && (share=cgi_variable("newshare"))) {
|
||||
lp_copy_service(DEFAULTS_SNUM, share);
|
||||
snum = lp_servicenumber(share);
|
||||
lp_do_parameter(snum, "print ok", "Yes");
|
||||
save_reload();
|
||||
snum = lp_servicenumber(share);
|
||||
}
|
||||
|
||||
printf("<FORM method=post>\n");
|
||||
|
||||
printf("<table>\n");
|
||||
printf("<tr><td><input type=submit name=selectshare value=\"Choose Printer\"></td>\n");
|
||||
printf("<td><select name=share>\n");
|
||||
if (snum < 0 || !lp_print_ok(snum))
|
||||
printf("<option value=\" \"> \n");
|
||||
for (i=0;i<lp_numservices();i++) {
|
||||
s = lp_servicename(i);
|
||||
if (s && (*s) && strcmp(s,"IPC$") && lp_print_ok(i)) {
|
||||
printf("<option %s value=\"%s\">%s\n",
|
||||
(share && strcmp(share,s)==0)?"SELECTED":"",
|
||||
s, s);
|
||||
}
|
||||
}
|
||||
printf("</select></td></tr><p>");
|
||||
|
||||
printf("<tr><td><input type=submit name=createshare value=\"Create Printer\"></td>\n");
|
||||
printf("<td><input type=text size=30 name=newshare></td></tr>\n");
|
||||
printf("</table>");
|
||||
|
||||
|
||||
if (snum >= 0) {
|
||||
printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
|
||||
printf("<input type=submit name=\"Delete\" value=\"Delete Printer\">\n");
|
||||
if (advanced == 0) {
|
||||
printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
|
||||
} else {
|
||||
printf("<input type=submit name=\"Basic\" value=\"Basic View\">\n");
|
||||
}
|
||||
printf("<p>\n");
|
||||
}
|
||||
|
||||
if (snum >= 0) {
|
||||
show_parameters(snum, 1, advanced, 1);
|
||||
}
|
||||
|
||||
if (advanced) {
|
||||
printf("<input type=hidden name=\"Advanced\" value=1>\n");
|
||||
}
|
||||
|
||||
printf("</FORM>\n");
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern FILE *dbf;
|
||||
int opt;
|
||||
char *page;
|
||||
|
||||
/* just in case it goes wild ... */
|
||||
alarm(300);
|
||||
|
||||
dbf = fopen("/dev/null", "w");
|
||||
|
||||
if (!dbf) dbf = stderr;
|
||||
|
||||
cgi_setup(SWATDIR);
|
||||
|
||||
while ((opt = getopt(argc, argv,"s:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 's':
|
||||
pstrcpy(servicesf,optarg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print_header();
|
||||
|
||||
charset_initialise();
|
||||
|
||||
/* if this binary is setuid then run completely as root */
|
||||
setuid(0);
|
||||
|
||||
load_config();
|
||||
|
||||
cgi_load_variables(NULL);
|
||||
|
||||
show_main_buttons();
|
||||
|
||||
page = cgi_baseurl();
|
||||
|
||||
if (strcmp(page, "globals")==0) {
|
||||
globals_page();
|
||||
} else if (strcmp(page,"shares")==0) {
|
||||
shares_page();
|
||||
} else if (strcmp(page,"printers")==0) {
|
||||
printers_page();
|
||||
} else {
|
||||
welcome_page();
|
||||
}
|
||||
|
||||
print_footer();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@ static int content_length;
|
||||
static int request_post;
|
||||
static int request_get;
|
||||
static char *query_string;
|
||||
static char *baseurl;
|
||||
|
||||
static void unescape(char *buf)
|
||||
{
|
||||
@ -610,12 +611,20 @@ void cgi_setup(char *rootdir)
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
if (strcmp(url,"/")) {
|
||||
if (strstr(url+1,"..")==0 && file_exist(url+1)) {
|
||||
cgi_download(url+1);
|
||||
}
|
||||
|
||||
printf("HTTP/1.1 200 OK\r\nConnection: close\r\n");
|
||||
|
||||
|
||||
baseurl = url+1;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
return the current pages URL
|
||||
***************************************************************************/
|
||||
char *cgi_baseurl(void)
|
||||
{
|
||||
return baseurl;
|
||||
}
|
||||
|
483
source3/web/swat.c
Normal file
483
source3/web/swat.c
Normal file
@ -0,0 +1,483 @@
|
||||
/*
|
||||
Unix SMB/Netbios implementation.
|
||||
Version 1.9.
|
||||
html smb.conf editing - prototype only
|
||||
Copyright (C) Andrew Tridgell 1997-1998
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifdef SYSLOG
|
||||
#undef SYSLOG
|
||||
#endif
|
||||
|
||||
#include "includes.h"
|
||||
#include "smb.h"
|
||||
|
||||
#define GLOBALS_SNUM -2
|
||||
#define DEFAULTS_SNUM -1
|
||||
|
||||
static pstring servicesf = CONFIGFILE;
|
||||
|
||||
|
||||
/* start the page with standard stuff */
|
||||
static void print_header(void)
|
||||
{
|
||||
printf("Content-type: text/html\r\n\r\n");
|
||||
printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n");
|
||||
printf("<HTML>\n<HEAD>\n<TITLE>Samba Web Administration Tool</TITLE>\n</HEAD>\n<BODY>\n\n");
|
||||
}
|
||||
|
||||
|
||||
/* finish off the page */
|
||||
static void print_footer(void)
|
||||
{
|
||||
printf("\n</BODY>\n</HTML>\n");
|
||||
}
|
||||
|
||||
/* include a lump of html in a page */
|
||||
static void include_html(char *fname)
|
||||
{
|
||||
FILE *f = fopen(fname,"r");
|
||||
char buf[1024];
|
||||
int ret;
|
||||
|
||||
if (!f) {
|
||||
printf("ERROR: Can't open %s\n", fname);
|
||||
return;
|
||||
}
|
||||
|
||||
while (!feof(f)) {
|
||||
ret = fread(buf, 1, sizeof(buf), f);
|
||||
if (ret <= 0) break;
|
||||
fwrite(buf, 1, ret, stdout);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
||||
/* display one editable parameter */
|
||||
static void show_parameter(int snum, struct parm_struct *parm)
|
||||
{
|
||||
int i;
|
||||
void *ptr = parm->ptr;
|
||||
|
||||
if (parm->class == P_LOCAL) {
|
||||
ptr = lp_local_ptr(snum, ptr);
|
||||
}
|
||||
|
||||
printf("<tr><td><A HREF=\"help/parameters.html#%s\">?</A> %s</td><td>",
|
||||
parm->label, parm->label);
|
||||
|
||||
switch (parm->type) {
|
||||
case P_CHAR:
|
||||
printf("<input type=text size=2 name=\"parm_%s\" value=\"%c\">",
|
||||
parm->label, *(char *)ptr);
|
||||
break;
|
||||
|
||||
case P_STRING:
|
||||
case P_USTRING:
|
||||
printf("<input type=text size=40 name=\"parm_%s\" value=\"%s\">",
|
||||
parm->label, *(char **)ptr);
|
||||
break;
|
||||
|
||||
case P_GSTRING:
|
||||
case P_UGSTRING:
|
||||
printf("<input type=text size=40 name=\"parm_%s\" value=\"%s\">",
|
||||
parm->label, (char *)ptr);
|
||||
break;
|
||||
|
||||
case P_BOOL:
|
||||
printf("<input type=radio name=\"parm_%s\" value=Yes %s>yes ", parm->label, (*(BOOL *)ptr)?"CHECKED":"");
|
||||
printf("<input type=radio name=\"parm_%s\" value=No %s>no", parm->label, (*(BOOL *)ptr)?"":"CHECKED");
|
||||
break;
|
||||
|
||||
case P_BOOLREV:
|
||||
printf("<input type=radio name=\"parm_%s\" value=Yes %s>yes ", parm->label, (*(BOOL *)ptr)?"":"CHECKED");
|
||||
printf("<input type=radio name=\"parm_%s\" value=No %s>no", parm->label, (*(BOOL *)ptr)?"CHECKED":"");
|
||||
break;
|
||||
|
||||
case P_INTEGER:
|
||||
printf("<input type=text size=8 name=\"parm_%s\" value=%d>", parm->label, *(int *)ptr);
|
||||
break;
|
||||
|
||||
case P_OCTAL:
|
||||
printf("<input type=text size=8 name=\"parm_%s\" value=0%o>", parm->label, *(int *)ptr);
|
||||
break;
|
||||
|
||||
case P_ENUM:
|
||||
for (i=0;parm->enum_list[i].name;i++)
|
||||
printf("<input type=radio name=\"parm_%s\" value=%s %s>%s ",
|
||||
parm->label, parm->enum_list[i].name,
|
||||
(*(int *)ptr)==parm->enum_list[i].value?"CHECKED":"",
|
||||
parm->enum_list[i].name);
|
||||
break;
|
||||
|
||||
}
|
||||
printf("</td></tr>\n");
|
||||
}
|
||||
|
||||
/* display a set of parameters for a service */
|
||||
static void show_parameters(int snum, int allparameters, int advanced, int printers)
|
||||
{
|
||||
int i = 0;
|
||||
struct parm_struct *parm;
|
||||
|
||||
printf("<table>\n");
|
||||
|
||||
while ((parm = lp_next_parameter(snum, &i, allparameters))) {
|
||||
if (parm->flags & FLAG_HIDE) continue;
|
||||
if (!advanced) {
|
||||
if (!printers && !(parm->flags & FLAG_BASIC)) continue;
|
||||
if (printers && !(parm->flags & FLAG_PRINT)) continue;
|
||||
}
|
||||
show_parameter(snum, parm);
|
||||
}
|
||||
printf("</table>\n");
|
||||
}
|
||||
|
||||
|
||||
static int save_reload(void)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
f = fopen(servicesf,"w");
|
||||
if (!f) {
|
||||
printf("failed to open %s for writing\n", servicesf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fprintf(f, "# Samba config file created using SWAT\n");
|
||||
|
||||
lp_dump(f);
|
||||
|
||||
fclose(f);
|
||||
|
||||
lp_killunused(NULL);
|
||||
|
||||
if (!lp_load(servicesf,False)) {
|
||||
printf("Can't reload %s\n", servicesf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* commit a set of parameters for a service */
|
||||
static void commit_parameters(int snum)
|
||||
{
|
||||
int i = 0;
|
||||
struct parm_struct *parm;
|
||||
pstring label;
|
||||
char *v;
|
||||
|
||||
while ((parm = lp_next_parameter(snum, &i, 1))) {
|
||||
sprintf(label, "parm_%s", parm->label);
|
||||
if ((v = cgi_variable(label))) {
|
||||
lp_do_parameter(snum, parm->label, v);
|
||||
}
|
||||
}
|
||||
|
||||
save_reload();
|
||||
}
|
||||
|
||||
|
||||
/* load the smb.conf file into loadparm. */
|
||||
static void load_config(void)
|
||||
{
|
||||
if (!lp_load(servicesf,False)) {
|
||||
printf("<b>Can't load %s - using defaults</b><p>\n",
|
||||
servicesf);
|
||||
}
|
||||
}
|
||||
|
||||
/* spit out the html for a link with an image */
|
||||
static void image_link(char *name,char *hlink, char *src, int width, int height)
|
||||
{
|
||||
printf("<A HREF=\"%s\"><img width=%d height=%d src=\"%s\" alt=\"%s\"></A>\n", hlink, width, height, src, name);
|
||||
}
|
||||
|
||||
/* display the main navigation controls at the top of each page along
|
||||
with a title */
|
||||
static void show_main_buttons(void)
|
||||
{
|
||||
printf("<H2 align=center>Samba Web Administration Tool</H2>\n");
|
||||
|
||||
image_link("Globals", "globals", "images/globals.gif", 50, 50);
|
||||
image_link("Shares", "shares", "images/shares.gif", 50, 50);
|
||||
image_link("Printers", "printers", "images/printers.gif", 50, 50);
|
||||
|
||||
printf("<HR>\n");
|
||||
}
|
||||
|
||||
/* display a welcome page */
|
||||
static void welcome_page(void)
|
||||
{
|
||||
include_html("help/welcome.html");
|
||||
}
|
||||
|
||||
|
||||
/* display a globals editing page */
|
||||
static void globals_page(void)
|
||||
{
|
||||
int advanced = 0;
|
||||
|
||||
printf("<H2>Global Variables</H2>\n");
|
||||
|
||||
if (cgi_variable("Advanced") && !cgi_variable("Basic"))
|
||||
advanced = 1;
|
||||
|
||||
if (cgi_variable("Commit")) {
|
||||
commit_parameters(GLOBALS_SNUM);
|
||||
}
|
||||
|
||||
printf("<FORM method=post>\n");
|
||||
|
||||
printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
|
||||
if (advanced == 0) {
|
||||
printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
|
||||
} else {
|
||||
printf("<input type=submit name=\"Basic\" value=\"Basic View\">\n");
|
||||
}
|
||||
printf("<p>\n");
|
||||
|
||||
show_parameters(GLOBALS_SNUM, 1, advanced, 0);
|
||||
|
||||
if (advanced) {
|
||||
printf("<input type=hidden name=\"Advanced\" value=1>\n");
|
||||
}
|
||||
|
||||
printf("</form>\n");
|
||||
}
|
||||
|
||||
/* display a shares editing page */
|
||||
static void shares_page(void)
|
||||
{
|
||||
char *share = cgi_variable("share");
|
||||
char *s;
|
||||
int snum=-1;
|
||||
int i;
|
||||
int advanced = 0;
|
||||
|
||||
if (share)
|
||||
snum = lp_servicenumber(share);
|
||||
|
||||
printf("<H2>Share Parameters</H2>\n");
|
||||
|
||||
if (cgi_variable("Advanced") && !cgi_variable("Basic"))
|
||||
advanced = 1;
|
||||
|
||||
if (cgi_variable("Commit") && snum >= 0) {
|
||||
commit_parameters(snum);
|
||||
}
|
||||
|
||||
if (cgi_variable("Delete") && snum >= 0) {
|
||||
lp_remove_service(snum);
|
||||
save_reload();
|
||||
share = NULL;
|
||||
snum = -1;
|
||||
}
|
||||
|
||||
if (cgi_variable("createshare") && (share=cgi_variable("newshare"))) {
|
||||
lp_copy_service(DEFAULTS_SNUM, share);
|
||||
save_reload();
|
||||
snum = lp_servicenumber(share);
|
||||
}
|
||||
|
||||
printf("<FORM method=post>\n");
|
||||
|
||||
printf("<table>\n");
|
||||
printf("<tr><td><input type=submit name=selectshare value=\"Choose Share\"></td>\n");
|
||||
printf("<td><select name=share>\n");
|
||||
if (snum < 0)
|
||||
printf("<option value=\" \"> \n");
|
||||
for (i=0;i<lp_numservices();i++) {
|
||||
s = lp_servicename(i);
|
||||
if (s && (*s) && strcmp(s,"IPC$")) {
|
||||
printf("<option %s value=\"%s\">%s\n",
|
||||
(share && strcmp(share,s)==0)?"SELECTED":"",
|
||||
s, s);
|
||||
}
|
||||
}
|
||||
printf("</select></td></tr><p>");
|
||||
|
||||
printf("<tr><td><input type=submit name=createshare value=\"Create Share\"></td>\n");
|
||||
printf("<td><input type=text size=30 name=newshare></td></tr>\n");
|
||||
printf("</table>");
|
||||
|
||||
|
||||
if (snum >= 0) {
|
||||
printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
|
||||
printf("<input type=submit name=\"Delete\" value=\"Delete Share\">\n");
|
||||
if (advanced == 0) {
|
||||
printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
|
||||
} else {
|
||||
printf("<input type=submit name=\"Basic\" value=\"Basic View\">\n");
|
||||
}
|
||||
printf("<p>\n");
|
||||
}
|
||||
|
||||
if (snum >= 0) {
|
||||
show_parameters(snum, 1, advanced, 0);
|
||||
}
|
||||
|
||||
if (advanced) {
|
||||
printf("<input type=hidden name=\"Advanced\" value=1>\n");
|
||||
}
|
||||
|
||||
printf("</FORM>\n");
|
||||
}
|
||||
|
||||
|
||||
/* display a printers editing page */
|
||||
static void printers_page(void)
|
||||
{
|
||||
char *share = cgi_variable("share");
|
||||
char *s;
|
||||
int snum=-1;
|
||||
int i;
|
||||
int advanced = 0;
|
||||
|
||||
if (share)
|
||||
snum = lp_servicenumber(share);
|
||||
|
||||
printf("<H2>Printer Parameters</H2>\n");
|
||||
|
||||
if (cgi_variable("Advanced") && !cgi_variable("Basic"))
|
||||
advanced = 1;
|
||||
|
||||
if (cgi_variable("Commit") && snum >= 0) {
|
||||
commit_parameters(snum);
|
||||
}
|
||||
|
||||
if (cgi_variable("Delete") && snum >= 0) {
|
||||
lp_remove_service(snum);
|
||||
save_reload();
|
||||
share = NULL;
|
||||
snum = -1;
|
||||
}
|
||||
|
||||
if (cgi_variable("createshare") && (share=cgi_variable("newshare"))) {
|
||||
lp_copy_service(DEFAULTS_SNUM, share);
|
||||
snum = lp_servicenumber(share);
|
||||
lp_do_parameter(snum, "print ok", "Yes");
|
||||
save_reload();
|
||||
snum = lp_servicenumber(share);
|
||||
}
|
||||
|
||||
printf("<FORM method=post>\n");
|
||||
|
||||
printf("<table>\n");
|
||||
printf("<tr><td><input type=submit name=selectshare value=\"Choose Printer\"></td>\n");
|
||||
printf("<td><select name=share>\n");
|
||||
if (snum < 0 || !lp_print_ok(snum))
|
||||
printf("<option value=\" \"> \n");
|
||||
for (i=0;i<lp_numservices();i++) {
|
||||
s = lp_servicename(i);
|
||||
if (s && (*s) && strcmp(s,"IPC$") && lp_print_ok(i)) {
|
||||
printf("<option %s value=\"%s\">%s\n",
|
||||
(share && strcmp(share,s)==0)?"SELECTED":"",
|
||||
s, s);
|
||||
}
|
||||
}
|
||||
printf("</select></td></tr><p>");
|
||||
|
||||
printf("<tr><td><input type=submit name=createshare value=\"Create Printer\"></td>\n");
|
||||
printf("<td><input type=text size=30 name=newshare></td></tr>\n");
|
||||
printf("</table>");
|
||||
|
||||
|
||||
if (snum >= 0) {
|
||||
printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
|
||||
printf("<input type=submit name=\"Delete\" value=\"Delete Printer\">\n");
|
||||
if (advanced == 0) {
|
||||
printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
|
||||
} else {
|
||||
printf("<input type=submit name=\"Basic\" value=\"Basic View\">\n");
|
||||
}
|
||||
printf("<p>\n");
|
||||
}
|
||||
|
||||
if (snum >= 0) {
|
||||
show_parameters(snum, 1, advanced, 1);
|
||||
}
|
||||
|
||||
if (advanced) {
|
||||
printf("<input type=hidden name=\"Advanced\" value=1>\n");
|
||||
}
|
||||
|
||||
printf("</FORM>\n");
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern FILE *dbf;
|
||||
int opt;
|
||||
char *page;
|
||||
|
||||
/* just in case it goes wild ... */
|
||||
alarm(300);
|
||||
|
||||
dbf = fopen("/dev/null", "w");
|
||||
|
||||
if (!dbf) dbf = stderr;
|
||||
|
||||
cgi_setup(SWATDIR);
|
||||
|
||||
while ((opt = getopt(argc, argv,"s:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 's':
|
||||
pstrcpy(servicesf,optarg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print_header();
|
||||
|
||||
charset_initialise();
|
||||
|
||||
/* if this binary is setuid then run completely as root */
|
||||
setuid(0);
|
||||
|
||||
load_config();
|
||||
|
||||
cgi_load_variables(NULL);
|
||||
|
||||
show_main_buttons();
|
||||
|
||||
page = cgi_baseurl();
|
||||
|
||||
if (strcmp(page, "globals")==0) {
|
||||
globals_page();
|
||||
} else if (strcmp(page,"shares")==0) {
|
||||
shares_page();
|
||||
} else if (strcmp(page,"printers")==0) {
|
||||
printers_page();
|
||||
} else {
|
||||
welcome_page();
|
||||
}
|
||||
|
||||
print_footer();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user