Previous | Contents | Index |
Process a popstore management command.
int POPSTORE_command_d (command, command_len, password_required, domain, domain_len user, user_len, password, password_len, usage, usage_len, out_info, out_info_len, context, output_proc) char *command; int command_len; int password_required char *domain; int domain_len; char *user; int user_len; char *password; int password_len; char *usage; int usage_len; char *out_info; int *out_info_len; void *context; int (*output_proc)();
The command to process. Used for input only.
command
Length in bytes of the command specified with
command_len
command
. Used for input only.Boolean flag indicating whether or not password authentication is required in order to process the command. Used for input only.
password_required
Name of the user domain associated with the user
domain
user
. Supply a value ofNULL
to indicate thedefault
domain. Used for input only.Length in bytes of the user domain name,
domain_len
domain
. Supply a value of zero to indicate thedefault
domain. Used for input only.Name of the popstore user account to authenticate against when password authentication is required. Used for input only.
user
Length in bytes of the username specified with
user_len
user
. Used for input only.User-supplied, plain text password to use when performing a password authentication. Used for input only.
password
Length in bytes of the plain text password specified with
password_len
password
. Used for input only.Usage description to be passed to site-supplied logging subroutines explaining the usage. Used for input only.
usage
Length in bytes of the usage description specified with
usage_len
usage
. Used for input only.Output buffer to receive post-processing information. Used for output only.
out_info
On input, the maximum length in bytes of the buffer pointed at by
out_info_len
out_info
. On output, the length in bytes of the information placed in theout_info
buffer. Used for input and output.Pointer to private client data to be passed to the client-supplied
context
output_proc
procedure. Used for input only.Address of a client-supplied subroutine to receive command processing output. Used for input only.
output_proc
The management commands documented in Chapter 4 are processed by the POPSTORE_command_d subroutine. Sites wanting to produce their own management interfaces can do so by generating management commands in the URL format described in Chapter 4 and then invokingPOPSTORE_command
to process those commands. The commands should reference site-supplied formatting files which then format the command results in the desired format.2 When called,POPSTORE_command_d
will use the active privileges of the caller to access and manipulate the popstore. Thepassword_required
argument can be used to implement a utility which itself has privileges but requires, for operation, that the user know the username and password of a popstore account with management privileges. When a non-zero value is supplied forpassword_required
, values for theuser
,user_len
,password
, andpassword_len
arguments must be supplied. The supplied plain text password will be authenticated against the specified account. If the password is correct and the account has theMANAGE
usage flag set, then the indicated command will be processed. Otherwise, aPOPSTORE_AUTHFAIL
orPOPSTORE_NOMANAGE
error will be returned. Moreover, the account will only be allowed to perform management functions on other accounts within the same management group. Whenuser
anduser_len
arguments are supplied, the operation to be undertaken will be restricted to accounts within the same management group and subgroups ofuser
. This behavior is regardless the setting of thepassword_required
argument. On return from callingPOPSTORE_command
, theout_info
buffer will contain the name of the formatting file associated with either the processed command'son_success
oron_error
parameter. If the command was successfully processed, then the buffer will contain the value specified with the command'son_success
parameter. If the command was not successfully processed, then the value specified by theon_error
parameter will be returned. If you do not care to have this information returned, specify a null value forout_info
orout_info_len
or both. Theoutput_proc
procedure is called repeatedly to received lines of output generated as a result of processing the command. The procedure takes the form
where the arguments to
int output_proc (context, data, data_len, is_eol, is_literal, is_error) void *context; char *data; int data_len; int is_eol; int is_literal; int is_error;output_proc
are as follows:Upon successful completion,
context
Pointer to the private client data supplied as input to POPSTORE_command. data
Data to output. This string can not be null terminated. data_len
Length in bytes of the data pointed at by data
.is_eol
When is_eol
has a non-zero value, theoutput_proc
procedure can want to output an end-of-line after this batch of formatted data.is_literal
When is_literal
has a non-zero value, theoutput_proc
procedure should not apply any quoting to the output data. The output data is literal data which was contained within the formatting file.is_error
When is_error
has a non-zero value, the output data is an error message relating to the processed command.output_proc
should return the valuePOPSTORE_SUCCESS
. In the event of an error, some value other thanPOPSTORE_SUCCESS
should be returned. A user-requested abort can be signified by returningPOPSTORE_ABORT
.
POPSTORE_SUCCESS Normal, successful completion. POPSTORE_BADARG Null value received for the out_proc
argument.POPSTORE_ERRORS The command was parsed and executed; execution of the command resulted in some errors which were reported via the output_proc
procedure.POPSTORE_AUTHFAIL Invalid password or username supplied. The command was not executed. POPSTORE_BADHEXVAL The command contained an illegal hexadecimal encoded character. The command was not executed. POPSTORE_CMDTOOLONG The command contained too many name=value pairs. The command was not executed. POPSTORE_CMDUNKOWN The command contained an unrecognized right-hand-side in a name=value pair. The command was not executed. POPSTORE_CMDUNKOWNL The command contained an unrecognized left-hand-side in a name=value pair. The command was not executed. POPSTORE_NOMANAGE Specified account lacks management privileges. The command was not executed. POPSTORE_PWDREQUIRED A username and password are required. The command was not executed. POPSTORE_VMERROR Insufficient virtual memory. The command was not executed. Any error returned by the output_proc
procedure.Any other popstore error.
2 This is precisely how the Web-based and command line oriented management utilities are implemented. |
Previous | Next | Contents | Index |