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

Diff of /trunk/grid-mw-security/ees/src/aos/aos.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 151  aos_context_t * getNextContext(aos_conte Line 151  aos_context_t * getNextContext(aos_conte
151    }    }
152        
153    if(current_storage != NULL){    if(current_storage != NULL){
     printf("Got storage\n");  
154      if(current_storage->last_context != NULL){      if(current_storage->last_context != NULL){
155        /* Pick up from last context */        /* Pick up from last context */
156        current_context = current_storage->last_context->next;        current_context = current_storage->last_context->next;
# Line 162  aos_context_t * getNextContext(aos_conte Line 161  aos_context_t * getNextContext(aos_conte
161    }    }
162    
163    if(current_context != NULL){    if(current_context != NULL){
     printf("Got context\n");  
164      if(context_class != ANY){      if(context_class != ANY){
       printf("Looking for context with class %i\n", context_class);  
165        while(current_context != NULL){        while(current_context != NULL){
166          printf("Checking context at %p\n", current_context);          /*printf("Checking context at %p\n", current_context);*/
167          printf("This one has %i\n", current_context->context_class);          /*printf("This one has %i\n", current_context->context_class);*/
168          if((current_context->context_class == context_class)){          if((current_context->context_class == context_class)){
169            /* Found context */            /* Found context */
170            printf("Found context\n");            /*printf("Found context\n");*/
171            break;            break;
172          }          }
173          current_context = current_context->next;          current_context = current_context->next;
# Line 305  EES_RC setAttributeIssuer(aos_attribute_ Line 302  EES_RC setAttributeIssuer(aos_attribute_
302   * sets attribute value in supplied attribute   * sets attribute value in supplied attribute
303   */   */
304  EES_RC setAttributeValue(aos_attribute_t* attribute, void* value, size_t size){  EES_RC setAttributeValue(aos_attribute_t* attribute, void* value, size_t size){
305    if(size == 0) {    if(value != NULL){
306      attribute->data = value;      if(size == 0) {
307      attribute->needs_free = 0;        attribute->data = value;
308          attribute->needs_free = 0;
309        } else {
310          attribute->data = calloc(1, size+1);
311          memcpy(attribute->data, value, size);
312          attribute->needs_free = 1;
313        }
314    } else {    } else {
315      attribute->data = calloc(1, size);      return EES_FAILURE;
     strncpy(attribute->data, value, size);  
     attribute->needs_free = 1;  
316    }    }
317    return EES_SUCCESS;    return EES_SUCCESS;
318  }  }
# Line 349  char* getAttributeValueAsString(aos_attr Line 350  char* getAttributeValueAsString(aos_attr
350   * returns data from supplied attribute casted to a int   * returns data from supplied attribute casted to a int
351   */   */
352  int getAttributeValueAsInt(aos_attribute_t* attribute){  int getAttributeValueAsInt(aos_attribute_t* attribute){
353    return (int) strtol(getAttributeValueAsString(attribute), NULL, 10);    char* string = getAttributeValueAsString(attribute);
354      return (int) strtol(string, NULL, 10);
355  }  }
356    
357  void* aos_get_value_by_label(const char *label){  void* aos_get_value_by_label(const char *label){
# Line 457  EES_RC aos_dump_argslist (void) { Line 459  EES_RC aos_dump_argslist (void) {
459    aos_context_t  * context;    aos_context_t  * context;
460    aos_attribute_t* attribute;    aos_attribute_t* attribute;
461    char *log_str = "aos_dump";    char *log_str = "aos_dump";
462    char *attribute_name = "", *attribute_value = "";    char *attribute_name;
463      char *attribute_value;
464    
465    eef_log(LOG_DEBUG, "Dumping aos");    eef_log(LOG_DEBUG, "Dumping aos");
466    rewindContexts(aos_get_storage());    rewindContexts(NULL);
467    while((context = getNextContext(ANY, NULL)) != NULL){    while((context = getNextContext(ANY, NULL)) != NULL){
468      if(context->context_class == OBLIGATION){      eef_log(LOG_DEBUG, "Context class: %i\n", context->context_class);
       eef_log(LOG_DEBUG, "Context obligation: %s\n", context->obligation_name);  
     }  
469      rewindAttributes(context);      rewindAttributes(context);
470      while((attribute = getNextAttribute(context))){      while((attribute = getNextAttribute(context))){
471        attribute_name = getAttributeId(attribute);        attribute_name = getAttributeId(attribute);
472        attribute_value = getAttributeValueAsString(attribute);        attribute_value = getAttributeValueAsString(attribute);
473        eef_log(LOG_DEBUG, "Attribute: %s with value: %s\n", attribute_name, attribute_value);        if(attribute_name && attribute_value){
474            eef_log(LOG_DEBUG, "\t%s=%s\n", attribute_name, attribute_value);
475          }
476      }      }
477    }    }
478    return EES_SUCCESS;    return EES_SUCCESS;
479  }  }
480    
 /*EES_PL_RC plugin_run(){*/  
 /*printf("Examining AOS\n");*/  
 /*while((_context = getNextContext(OBLIGATION, NULL))){*/  
 /*printf("Context: %s\n", getContextObligationId(_context));*/  
 /*if(strncmp(getContextObligationId(_context), "uidgid", strlen("uidgid")) == 0){*/  
 /*while((_attribute = getNextAttribute(_context))){*/  
 /*if(strncmp(getAttributeId(_attribute), "posix-uid", strlen("posix-uid")) == 0){*/  
 /*printf("Got UID: %s\n", getAttributeId(_attribute));*/  
 /*_real_uid = getAttributeValueAsInt(_attribute);*/  
 /*} else if(strncmp(getAttributeId(_attribute), "posix-gid", strlen("posix-gid")) == 0){*/  
 /*printf("Got primary GID: %s\n", getAttributeId(_attribute));*/  
 /*}*/  
 /*}*/  
 /*}*/  
 /*}*/  
   
 /*if(_do_uid_check){*/  
 /**//*if(getpwuid()){*/  
   
 /**//*}*/  
 /*}*/  
 /*downgradeEffectiveToRealUid(_real_uid, _saved_uid);*/  
 /*endpwent();*/  
   
 /*return 0;*/  
 /*}*/  
   

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

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