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

Diff of /trunk/grid-mw-security/ees/src/app/main.c

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

revision 850 by aramv, Mon Sep 28 15:08:31 2009 UTC revision 851 by aramv, Mon Sep 28 20:22:51 2009 UTC
# Line 2  Line 2 
2  #include "aos.h"  #include "aos.h"
3  #include "ees_config.h"  #include "ees_config.h"
4  #include <string.h>  #include <string.h>
 #include <stdlib.h>  
5  #include <stdio.h>  #include <stdio.h>
6  #include <stdarg.h>  #include <stdarg.h>
7  #ifndef S_SPLINT_S  #ifndef S_SPLINT_S
8  #include <unistd.h>  #include <unistd.h>
9  #endif  #endif
10  #include <errno.h>  #include <errno.h>
 #include <sys/stat.h>  
 #include <sys/fcntl.h>  
   
11    
12    
13  int main (int argc, char* argv[]){  int main (int argc, char* argv[]){
         int _fd = 0;  
         char *_string = NULL;  
         char *cert_file = "/home/aczid/.globus/usercert.pem";  
14          char *config_file = "/home/aczid/example_1.pdl";          char *config_file = "/home/aczid/example_1.pdl";
   struct stat _stat;  
15    
16          printf("Modules dir: %s\n", MODULE_DIR);          printf("Modules dir: %s\n", MODULE_DIR);
17                    
# Line 28  int main (int argc, char* argv[]){ Line 20  int main (int argc, char* argv[]){
20    } else {    } else {
21      printf("Loaded config file: %s\n", config_file);      printf("Loaded config file: %s\n", config_file);
22    
     if((_fd = open(cert_file, O_RDONLY)) == -1){  
       eef_log(LOG_ERR, "Cannot open file %s: %s\n", cert_file, strerror(errno));  
       exit(1);  
     }  
   
     if(fstat(_fd, &_stat) == -1){  
       eef_log(LOG_ERR, "Cannot stat file %s: %s\n", cert_file, strerror(errno));  
       exit(1);  
     }  
   
     _string = calloc(1, (_stat.st_size+1)*sizeof(char));  
   
     if(((read(_fd, _string, _stat.st_size))) == -1){  
       eef_log(LOG_ERR, "Cannot read file %s\n", cert_file);  
       exit(1);  
     } else {  
       printf("Read %lld bytes from file '%s'\n", (long long int) _stat.st_size, cert_file);  
     }  
   
     close(_fd);  
23      setObligation("test", "foobar");      setObligation("test", "foobar");
   
     /*_string[_stat.st_size] = '\0';*/  
   
   
     /*eef_log(LOG_ERR,"My PEM string: %s\n", _string);*/  
   
     /*AOS_set_string("fooskldfjlskdjfkl;sjfl;sdjfl;dsjl;fjsdlfjsldfjsdkfj", "bar");*/  
   
     /*AOS_set_string("my_pemstring", "bladiebladiebla");*/  
     /*AOS_set_string("foo", "barbaz");*/  
   
     setObligation("my_pemstring", _string);  
   
     /*EEF_Run("plugin_a");*/  
     /*EEF_Run("plugin_b");*/  
   
     /*eef_log(LOG_ERR, "My PEM string: %s\n", (char*) AOS_get_value_by_label("my_pemstring"));*/  
   
     free(_string);  
24    }    }
25    EEF_Term();    EEF_Term();
26    return 0;    return 0;

Legend:
Removed from v.850  
changed lines
  Added in v.851

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