1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

changed is_root() to am_root() to prevent clash with variable names.

(This used to be commit 52f47b8d2e)
This commit is contained in:
Andrew Tridgell 1998-11-11 23:47:03 +00:00
parent f9584f93be
commit 01ceb5e2d7
3 changed files with 12 additions and 14 deletions

View File

@ -2629,7 +2629,7 @@ int smbw_stat(const char *fname, struct stat *st);
void cgi_load_variables(FILE *f1);
char *cgi_variable(char *name);
BOOL is_root(void);
BOOL am_root(void);
char *get_user_name(void);
void cgi_setup(char *rootdir, int auth_required);
char *cgi_baseurl(void);

View File

@ -321,7 +321,7 @@ static int cgi_handle_authorization(char *line)
/***************************************************************************
is this root?
***************************************************************************/
BOOL is_root(void)
BOOL am_root(void)
{
if ((C_user) && (strcmp(C_user,"root") == 0)) {
return( True);
@ -411,7 +411,7 @@ void cgi_setup(char *rootdir, int auth_required)
char *x;
/* Save the users name if available */
if ((x = getenv("REMOTE_USER"))!=NULL) {
if ((x = getenv("REMOTE_USER"))) {
C_user = strdup(x);
} else {
C_user = "";

View File

@ -405,7 +405,7 @@ static void show_main_buttons(void)
image_link("Home", "", "images/home.gif");
/* Root gets full functionality */
if ( is_root() == True) {
if (am_root() == True) {
image_link("Globals", "globals", "images/globals.gif");
image_link("Shares", "shares", "images/shares.gif");
image_link("Printers", "printers", "images/printers.gif");
@ -632,7 +632,7 @@ static BOOL talk_to_smbpasswd(char *old, char *new)
/*
* smbpasswd requires a regular old user to send their old password
*/
if ( is_root() == False) {
if (am_root() == False) {
n = (strlen(old) <= (MAX_STRINGLEN)) ? strlen(old) : (MAX_STRINGLEN);
strncpy( line, old, n);
line[n] = '\n'; n++; /* add carriage return */
@ -727,7 +727,7 @@ static BOOL talk_to_smbpasswd(char *old, char *new)
/* Root can do more */
if (is_root() == True) {
if (am_root() == True) {
if (cgi_variable(add_user_flag)) {
/*
* Add a user
@ -838,7 +838,6 @@ static BOOL become_id(uid_t uid,gid_t gid)
****************************************************************************/
static void chg_passwd(void)
{
char *s;
struct passwd *pass = NULL;
BOOL rslt;
@ -855,7 +854,7 @@ static void chg_passwd(void)
if (!cgi_variable(disable_user_flag)) {
/* If current user is not root, make sure old password has been specified */
if ((is_root() == False) && (strlen( cgi_variable(old_pswd)) <= 0)) {
if ((am_root() == False) && (strlen( cgi_variable(old_pswd)) <= 0)) {
printf("<p> Must specify \"Old Password\" \n");
return;
}
@ -875,7 +874,7 @@ static void chg_passwd(void)
}
/* Get the UID/GID of the user, and become that user */
if (is_root() == False) {
if (am_root() == False) {
pass = Get_Pwnam(cgi_variable(user),True);
if (pass == NULL) {
printf("<p> User uid unknown \n");
@ -902,7 +901,7 @@ static void chg_passwd(void)
rslt = talk_to_smbpasswd( cgi_variable(old_pswd), cgi_variable(new_pswd));
if (is_root() == False) {
if (am_root() == False) {
if (rslt == True) {
printf("<p> The passwd for '%s' has been changed. \n",cgi_variable(user));
} else {
@ -919,7 +918,6 @@ static void chg_passwd(void)
static void passwd_page(void)
{
char *new_name;
int i;
printf("<H2>Password Manager</H2>\n");
@ -941,7 +939,7 @@ static void passwd_page(void)
}
printf("<p> User Name : <input type=text size=30 name=%s value=%s> \n", user, new_name);
if (is_root() == False) {
if (am_root() == False) {
printf("<p> Old Password: <input type=password size=30 name=%s>\n",old_pswd);
}
printf("<p> New Password: <input type=password size=30 name=%s>\n",new_pswd);
@ -950,7 +948,7 @@ static void passwd_page(void)
printf("</select></td></tr><p>");
printf("<tr><td>");
printf("<input type=submit name=%s value=\"Change Password\">", chg_passwd_flag);
if (is_root() == True) {
if (am_root() == True) {
printf("<input type=submit name=%s value=\"Add New User\">", add_user_flag);
printf("<input type=submit name=%s value=\"Disable User\">", disable_user_flag);
}
@ -1102,7 +1100,7 @@ static void printers_page(void)
page = cgi_pathinfo();
/* Root gets full functionality */
if ( is_root() == True) {
if (am_root() == True) {
if (strcmp(page, "globals")==0) {
globals_page();
} else if (strcmp(page,"shares")==0) {