/[pdpsoft]/trunk/grid-mw-security/ees/plugin_examples/posix_enf/src/posix_enf.c
ViewVC logotype

Diff of /trunk/grid-mw-security/ees/plugin_examples/posix_enf/src/posix_enf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1582 by aramv, Wed Mar 17 13:31:46 2010 UTC revision 1583 by aramv, Fri Mar 19 17:29:41 2010 UTC
# Line 87  EES_PL_RC plugin_initialize(int argc, ch Line 87  EES_PL_RC plugin_initialize(int argc, ch
87    
88    /* sanity checks */    /* sanity checks */
89    if(_maxsgid > NGROUPS){    if(_maxsgid > NGROUPS){
90      eef_log(LOG_ERR, "%s: Option -_maxsgid %i exceeds the system limit of %i", _plugin_name, _maxsgid, NGROUPS);      eef_log(LOG_ERR, "%s: Option -maxsgid %i exceeds the system limit of %i", _plugin_name, _maxsgid, NGROUPS);
91      return EES_PL_FAILURE;      return EES_PL_FAILURE;
92    } else if(_maxsgid == MAX_UNDEFINED){    } else if(_maxsgid == MAX_UNDEFINED){
93      _maxsgid = NGROUPS;      _maxsgid = NGROUPS;
# Line 117  EES_PL_RC plugin_run(){ Line 117  EES_PL_RC plugin_run(){
117      if(strncmp(getContextObligationId(_context), "uidgid", strlen("uidgid")) == 0){      if(strncmp(getContextObligationId(_context), "uidgid", strlen("uidgid")) == 0){
118        rewindAttributes(_context);        rewindAttributes(_context);
119        while((_attribute = getNextAttribute(_context))){        while((_attribute = getNextAttribute(_context))){
120            /*printf("Attr: %s\n", getAttributeId(_attribute));*/
121          if(strncmp(getAttributeId(_attribute), "posix-uid", strlen("posix-uid")) == 0){          if(strncmp(getAttributeId(_attribute), "posix-uid", strlen("posix-uid")) == 0){
122              /*printf("UID: %s\n", getAttributeValueAsString(_attribute));*/
123            _target_uid = getAttributeValueAsInt(_attribute);            _target_uid = getAttributeValueAsInt(_attribute);
124          } else if(strncmp(getAttributeId(_attribute), "posix-gid", strlen("posix-gid")) == 0){          } else if(strncmp(getAttributeId(_attribute), "posix-gid", strlen("posix-gid")) == 0){
125              /*printf("GID: %s\n", getAttributeValueAsString(_attribute));*/
126            _target_gid = getAttributeValueAsInt(_attribute);            _target_gid = getAttributeValueAsInt(_attribute);
127          }          }
128        }        }
129      }      }
130    }    }
131    
132    eef_log(LOG_DEBUG, "Got target UID: %i\n", _target_uid);    if(_target_uid > -1){
133    eef_log(LOG_DEBUG, "Got target primary GID: %i\n", _target_uid);      eef_log(LOG_DEBUG, "Got target UID: %i\n", _target_uid);
134        eef_log(LOG_DEBUG, "Got target primary GID: %i\n", _target_uid);
135    
136    if(_do_uid_check){      if(_do_uid_check){
137      /*printPasswordEntry(_target_uid);*/        printPasswordEntry(_target_uid);
138        }
139        downgradeEffectiveToRealUid(&_real_uid, &_saved_uid);
140        endpwent();
141        return EES_PL_SUCCESS;
142    }    }
   downgradeEffectiveToRealUid(&_real_uid, &_saved_uid);  
   endpwent();  
143    
144    return EES_PL_SUCCESS;    return EES_PL_FAILURE;
145  }  }
146    
147  /* terminate plugin */  /* terminate plugin */

Legend:
Removed from v.1582  
changed lines
  Added in v.1583

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28