~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

Viewing changes to src/libecryptfs/key_mod.c

  • Committer: Dustin Kirkland
  • Date: 2009-02-13 15:57:24 UTC
  • Revision ID: kirkland@canonical.com-20090213155724-1q3qz2o0cbyimu9x
debian/ubuntu packaging

Initial checkin of the Debian/Ubuntu packaging

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * 02111-1307, USA.
19
19
 */
20
20
 
 
21
#include "config.h"
21
22
#include <dirent.h>
22
23
#include <stdlib.h>
23
24
#include <string.h>
252
253
        }
253
254
        if (!(dp = opendir(dir_name))) {
254
255
                syslog(LOG_WARNING,
255
 
                       "ERROR: Could not open key_mod directory [%s]\n",
256
 
                       dir_name);
 
256
                       "ERROR: Could not open key_mod directory\n");
257
257
                rc = -EPERM;
258
258
                goto out;
259
259
        }
272
272
                        continue;
273
273
                if (asprintf(&path, "%s/%s", key_mod_dir, ep->d_name) == -1) {
274
274
                        syslog(LOG_ERR, "Out of memory\n");
275
 
                        closedir(dp);
276
275
                        rc = -ENOMEM;
277
276
                        goto out;
278
277
                }
290
289
                                "err = [%s]. The key module is likely using "
291
290
                                "the deprecated key module API.\n", path,
292
291
                                dlerror());
293
 
                        goto end_loop_dlclose;
 
292
                        goto end_loop;
294
293
                }
295
294
                new_key_mod = malloc(sizeof(struct ecryptfs_key_mod));
296
295
                if (!new_key_mod) {
297
296
                        syslog(LOG_ERR, "Out of memory\n");
298
 
                        closedir(dp);
299
 
                        dlclose(handle);
300
297
                        free(path);
301
298
                        rc = -ENOMEM;
302
299
                        goto out;
308
305
                                "failed to return ops for [%s]\n", path);
309
306
                        free(new_key_mod);
310
307
                        rc = 0;
311
 
                        goto end_loop_dlclose;
 
308
                        goto end_loop;
312
309
                }
313
310
                if ((rc = ecryptfs_fill_in_dummy_ops(new_key_mod->ops))) {
314
311
                        syslog (LOG_ERR, "Error attempting to fill in missing  "
316
313
                                path, rc);
317
314
                        free(new_key_mod);
318
315
                        rc = 0;
319
 
                        goto end_loop_dlclose;                  
 
316
                        goto end_loop;                  
320
317
                }
321
318
                if ((rc = new_key_mod->ops->init(&new_key_mod->alias))) {
322
319
                        syslog(LOG_ERR, "Error initializing key module [%s]; "
323
320
                               "rc = [%d]\n", path, rc);
324
321
                        free(new_key_mod);
325
322
                        rc = 0;
326
 
                        goto end_loop_dlclose;
 
323
                        goto end_loop;
327
324
                }
328
325
                new_key_mod->lib_handle = handle;
329
326
                new_key_mod->lib_path = path;
330
327
                curr_key_mod->next = new_key_mod;
331
328
                curr_key_mod = new_key_mod;
332
329
                continue;
333
 
        end_loop_dlclose:
334
 
                dlclose(handle);
335
330
        end_loop:
336
331
                free(path);
337
332
        }