httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@hyperreal.com>
Subject cvs commit: apache/src util_script.c
Date Fri, 25 Apr 1997 05:29:56 GMT
randy       97/04/24 22:29:55

  Modified:    src       util_script.c
  Log:
  Get this right. Roy pointed out a couple of Bad Things (tm) and it seems
  this patch even broke the non ~user functionality by not setting the group.
  
  Revision  Changes    Path
  1.50      +12 -9     apache/src/util_script.c
  
  Index: util_script.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/util_script.c,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -C3 -r1.49 -r1.50
  *** util_script.c	1997/04/24 23:25:09	1.49
  --- util_script.c	1997/04/25 05:29:53	1.50
  ***************
  *** 433,442 ****
    void call_exec (request_rec *r, char *argv0, char **env, int shellcmd) 
    {
        char *execuser;
        core_dir_config *conf;
        struct passwd *pw;
        struct group *gr;
  -     char *grpname;
        
        conf = (core_dir_config *)get_module_config(r->per_dir_config, &core_module);
    
  --- 433,443 ----
    void call_exec (request_rec *r, char *argv0, char **env, int shellcmd) 
    {
        char *execuser;
  +     char *grpname;
  +     char *useruri;
        core_dir_config *conf;
        struct passwd *pw;
        struct group *gr;
        
        conf = (core_dir_config *)get_module_config(r->per_dir_config, &core_module);
    
  ***************
  *** 543,566 ****
        if ( suexec_enabled &&
    	 ((r->server->server_uid != user_id) ||
    	  (r->server->server_gid != group_id) ||
  ! 	  (!strncmp("/~",r->uri,2))) ) {
    
            if (!strncmp("/~",r->uri,2)) {
  !             r->uri += 2;
  !             if ((pw = getpwnam (getword_nc (r->pool, &r->uri, '/'))) == NULL)
{
    		log_unixerr("getpwnam", NULL, "invalid username", r->server);
    		return;
    	    }
  !             r->uri -= 2;
                if ((gr = getgrgid (pw->pw_gid)) == NULL) {
    		if ((grpname = palloc (r->pool, 16)) == NULL) 
    		    return;
    		else
  ! 		    ap_snprintf(grpname, sizeof(grpname), "%d\0", pw->pw_gid);
    	    }
  ! 	    else
    		grpname = gr->gr_name;
  !             execuser = (char *) palloc (r->pool, (sizeof(pw->pw_name) + 1));
                execuser = pstrcat (r->pool, "~", pw->pw_name, NULL);
            }
    	else {
  --- 544,568 ----
        if ( suexec_enabled &&
    	 ((r->server->server_uid != user_id) ||
    	  (r->server->server_gid != group_id) ||
  ! 	  (!strncmp("/~", r->uri, 2))) ) {
    
            if (!strncmp("/~",r->uri,2)) {
  !             useruri = r->uri;
  !             useruri += 2;
  !             if ((pw = getpwnam (getword_nc (r->pool, &useruri, '/'))) == NULL)
{
    		log_unixerr("getpwnam", NULL, "invalid username", r->server);
    		return;
    	    }
  !             useruri -= 2;
                if ((gr = getgrgid (pw->pw_gid)) == NULL) {
    		if ((grpname = palloc (r->pool, 16)) == NULL) 
    		    return;
    		else
  ! 		    ap_snprintf(grpname, sizeof(grpname), "%d", pw->pw_gid);
    	    }
  !             else
    		grpname = gr->gr_name;
  ! 
                execuser = pstrcat (r->pool, "~", pw->pw_name, NULL);
            }
    	else {
  ***************
  *** 572,578 ****
    		log_unixerr("getgrgid", NULL, "invalid groupid", r->server);
    		return;
    	    }
  !             execuser = (char *) palloc (r->pool, sizeof(pw->pw_name));
                execuser = pw->pw_name;
            }
      
  --- 574,581 ----
    		log_unixerr("getgrgid", NULL, "invalid groupid", r->server);
    		return;
    	    }
  ! 
  !             grpname = gr->gr_name;
                execuser = pw->pw_name;
            }
      
  
  
  

Mime
View raw message