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
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
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.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
static const char *baseurl;
static char *pathinfo;
static char *C_user;
-static BOOL inetd_server;
-static BOOL got_request;
+static bool inetd_server;
+static bool got_request;
static char *grab_line(FILE *f, int *cl)
{
char *ret2;
if (len == 0) len = 1024;
else len *= 2;
- ret2 = (char *)SMB_REALLOC(ret, len);
+ ret2 = (char *)SMB_REALLOC_KEEP_OLD_ON_ERROR(ret, len);
if (!ret2) return ret;
ret = ret2;
}
}
-
- ret[i] = 0;
+ if (ret) {
+ ret[i] = 0;
+ }
return ret;
}
browser. Also doesn't allow for variables[] containing multiple variables
with the same name and the same or different values.
***************************************************************************/
+
const char *cgi_variable(const char *name)
{
int i;
return NULL;
}
+/***************************************************************************
+ Version of the above that can't return a NULL pointer.
+***************************************************************************/
+
+const char *cgi_variable_nonull(const char *name)
+{
+ const char *var = cgi_variable(name);
+ if (var) {
+ return var;
+ } else {
+ return "";
+ }
+}
+
/***************************************************************************
tell a browser about a fatal error in the http processing
***************************************************************************/
/***************************************************************************
handle a http authentication line
***************************************************************************/
-static BOOL cgi_handle_authorization(char *line)
+static bool cgi_handle_authorization(char *line)
{
char *p;
fstring user, user_pass;
/***************************************************************************
is this root?
***************************************************************************/
-BOOL am_root(void)
+bool am_root(void)
{
if (geteuid() == 0) {
return( True);
**/
void cgi_setup(const char *rootdir, int auth_required)
{
- BOOL authenticated = False;
+ bool authenticated = False;
char line[1024];
char *url=NULL;
char *p;
/***************************************************************************
return the hostname of the client
***************************************************************************/
-char *cgi_remote_host(void)
+const char *cgi_remote_host(void)
{
if (inetd_server) {
return get_peer_name(1,False);
/***************************************************************************
return the hostname of the client
***************************************************************************/
-char *cgi_remote_addr(void)
+const char *cgi_remote_addr(void)
{
if (inetd_server) {
return get_peer_addr(1);
/***************************************************************************
return True if the request was a POST
***************************************************************************/
-BOOL cgi_waspost(void)
+bool cgi_waspost(void)
{
if (inetd_server) {
return request_post;