/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to plugbasedclient.c

plugbasedclient:
        Added support to disable plugins
        Added support to change plugin directory

mandosclient.c
        Fixed some funtion calls that lacked error handling
        small bugfix

Show diffs side-by-side

added added

removed removed

Lines of Context:
120
120
  fd_set rfds_orig;
121
121
  int ret, maxfd = 0;
122
122
  process *process_list = NULL;
123
 
  uid_t uid = 65534;
124
 
  gid_t gid = 65534;
 
123
 
125
124
  /* The options we understand. */
126
125
  struct argp_option options[] = {
127
126
    { .name = "global-options", .key = 'g',
136
135
    { .name = "plugin-dir", .key = 128,
137
136
      .arg = "Directory", .flags = 0,
138
137
      .doc = "Option to change directory to search for plugins" },
139
 
    { .name = "userid", .key = 129,
140
 
      .arg = "Id", .flags = 0,
141
 
      .doc = "Option to change which user id the plugins will run as" },
142
 
    { .name = "groupid", .key = 130,
143
 
      .arg = "Id", .flags = 0,
144
 
      .doc = "Option to change which group id the plugins will run as" },
145
138
    { .name = NULL }
146
139
  };
147
140
  
182
175
    case 128:
183
176
      plugindir = arg;
184
177
      break;
185
 
    case 129:
186
 
      uid = (uid_t)strtol(arg, NULL, 10);
187
 
      break;
188
 
    case 130:
189
 
      gid = (gid_t)strtol(arg, NULL, 10);
190
 
      break;
191
178
    case ARGP_KEY_ARG:
192
179
      argp_usage (state);
193
180
      break;
215
202
  
216
203
/*   return 0; */
217
204
 
218
 
  ret = setuid(uid);
219
 
  if (ret == -1){
220
 
    perror("setuid");
221
 
  }
222
 
 
223
 
  setgid(gid);
224
 
  if (ret == -1){
225
 
    perror("setuid");
226
 
  }
227
 
  
228
205
  dir = opendir(plugindir);
229
206
  
230
207
  if(dir == NULL){