summaryrefslogtreecommitdiff
path: root/source3/web/cgi.c
diff options
context:
space:
mode:
authorHerb Lewis <herb@samba.org>1998-11-11 21:37:44 +0000
committerHerb Lewis <herb@samba.org>1998-11-11 21:37:44 +0000
commit6559aa10d55dd7a71e3b7c7cdee1ff3c7a58ac37 (patch)
tree4d7ef33d51150e903c0fdbeb2fbb667423af7952 /source3/web/cgi.c
parentdcea9c382d712b310d0c2afb73d1d0321ad4b06a (diff)
downloadsamba-6559aa10d55dd7a71e3b7c7cdee1ff3c7a58ac37.tar.gz
samba-6559aa10d55dd7a71e3b7c7cdee1ff3c7a58ac37.tar.bz2
samba-6559aa10d55dd7a71e3b7c7cdee1ff3c7a58ac37.zip
added password change functionality to swat
(This used to be commit 06d4026cf1521766b52766193774f1fd8dd70c81)
Diffstat (limited to 'source3/web/cgi.c')
-rw-r--r--source3/web/cgi.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/source3/web/cgi.c b/source3/web/cgi.c
index 38be0de3c6..a11abe074e 100644
--- a/source3/web/cgi.c
+++ b/source3/web/cgi.c
@@ -44,6 +44,7 @@ static int request_post;
static char *query_string;
static char *baseurl;
static char *pathinfo;
+static char *C_user;
static void unescape(char *buf)
{
@@ -311,16 +312,32 @@ static int cgi_handle_authorization(char *line)
user = line;
pass = p+1;
- /* currently only allow connections as root */
- if (strcmp(user,"root")) {
- cgi_setup_error("401 Bad Authorization", "",
- "incorrect username/password");
- }
-
+ /* Save the users name */
+ C_user = strdup(user);
return pass_check(user, pass, strlen(pass), NULL, NULL);
}
+/***************************************************************************
+is this root?
+ ***************************************************************************/
+BOOL is_root()
+{
+ if ((C_user) && (strcmp(C_user,"root") == 0)) {
+ return( True);
+ } else {
+ return( False);
+ }
+}
+
+/***************************************************************************
+return a ptr to the users name
+ ***************************************************************************/
+char * get_user_name()
+{
+ return(C_user);
+}
+
/***************************************************************************
handle a file download
@@ -390,6 +407,16 @@ void cgi_setup(char *rootdir, int auth_required)
}
if (getenv("CONTENT_LENGTH") || getenv("REQUEST_METHOD")) {
+
+ char *x;
+
+ /* Save the users name if available */
+ if (x = getenv("REMOTE_USER")) {
+ C_user = strdup(x);
+ } else {
+ C_user = "";
+ }
+
/* assume we are running under a real web server */
return;
}