~ubuntu-branches/debian/wheezy/netatalk/wheezy

« back to all changes in this revision

Viewing changes to libatalk/acl/ldap.c

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2011-06-05 21:04:21 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20110605210421-19gag2srevj0ocxh
Tags: 2.2~beta4-1
* New upstream release.
  + Fixes "Internal Error" after ad_open on sparc.
    Closes: bug#606005. Thanks to Alfredo Sola.
* Adjust references to unofficial packages in README.Debian.
* Use dversionmangle (not uversionmangle) in watch file. Fix add
  leading dash (-) to upstream version in mangling.
* Update patches:
  + Drop patches 107 and 294 (Zeroconf support): Implemented
    (differently) upstream now.
  + Drop patches 109 and 112 (avoid broken XFS linkage) obsolete.
  + Drop patch 200 (hostname resolving): adopted upstream.
  + Refresh patch 205.
* Rewrite copyright file using draft 174 of DEP-5 format.
* Build-depend on and recommend unversioned (i.e. default) BerkeleyDB
  packages.
  Closes: bug#621413. Thanks to Ondřej Surý.
  Simplify suggestions on older versioned BerkeleyDB packages.
* Stop installing some documentation dropped upstream, and let CDBS
  automagically handle some of the remains.
* Update control file:
  + Bump policy compliance to standards-version 3.9.2.
  + Shorten Vcs-* URLs.
* Add patches 115 and (for automade file) 214 to avoid installing
  unneeded /default dir.
  Closes: bug#628119. Thanks to Russell Muetzelfeldt and Luk Claes.
* Don't ship .la files. Closes: bug#621849. Thanks to Andreas Metzler
  and Luk Claes.
* Stop renaming afile and achfile, dropped upstream.
* Explicitly enable DDP (AppleTalk), now disabled by default.
* Enable Zeroconf, should be stable now.
* Simplify package relations:
  + Drop (build-)dependency fallback unneeded even for oldstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
  $Id: ldap.c,v 1.7 2010-04-23 11:37:06 franklahm Exp $
3
2
  Copyright (c) 2008,2009 Frank Lahm <franklahm@gmail.com>
4
3
 
5
4
  This program is free software; you can redistribute it and/or modify
17
16
#include "config.h"
18
17
#endif /* HAVE_CONFIG_H */
19
18
 
 
19
#ifdef HAVE_LDAP
 
20
 
20
21
#include <stdio.h>
21
22
#include <stdlib.h>
22
23
#include <sys/time.h>
23
24
#include <string.h>
24
25
#include <errno.h>
 
26
#define LDAP_DEPRECATED 1
25
27
#include <ldap.h>
26
28
 
27
29
#include <atalk/logger.h>
247
249
 * Interface
248
250
 ********************************************************/
249
251
 
250
 
/* 
251
 
 * returns allocated storage in uuid_string, caller must free it
252
 
 * returns 0 on success, -1 on error or not found
 
252
/*! 
 
253
 * Search UUID for name in LDAP
 
254
 *
 
255
 * Caller must free uuid_string when done with it
 
256
 *
 
257
 * @param name        (r) name to search
 
258
 * @param type        (r) type of USER or GROUP
 
259
 * @param uuid_string (w) result as pointer to allocated UUID-string
 
260
 *
 
261
 * @returns 0 on success, -1 on error or not found
253
262
 */
254
263
int ldap_getuuidfromname( const char *name, uuidtype_t type, char **uuid_string) {
255
264
    int ret;
258
267
    char *attributes[]  = { ldap_uuid_attr, NULL};
259
268
    char *ldap_attr;
260
269
 
 
270
    if (!ldap_config_valid)
 
271
        return -1;
 
272
 
261
273
    /* make filter */
262
274
    if (type == UUID_GROUP)
263
275
        ldap_attr = ldap_group_attr;
283
295
 * LDAP search wrapper
284
296
 * returns allocated storage in name, caller must free it
285
297
 * returns 0 on success, -1 on error or not found
 
298
 * 
 
299
 * @param uuidstr  (r) uuid to search as ascii string
 
300
 * @param name     (w) return pointer to name as allocated string
 
301
 * @param type     (w) return type: USER or GROUP
 
302
 *
 
303
 * returns 0 on success, -1 on errror
286
304
 */
287
 
int ldap_getnamefromuuid( char *uuidstr, char **name, uuidtype_t *type) {
 
305
int ldap_getnamefromuuid( const char *uuidstr, char **name, uuidtype_t *type) {
288
306
    int ret;
289
307
    int len;
290
308
    char filter[256];       /* this should really be enough. we dont want to malloc everything! */
291
309
    char *attributes[]  = { NULL, NULL};
292
310
 
 
311
    if (!ldap_config_valid)
 
312
        return -1;
 
313
 
293
314
    /* make filter */
294
315
    len = snprintf( filter, 256, "%s=%s", ldap_uuid_attr, uuidstr);
295
316
    if (len >= 256 || len == -1) {
315
336
 
316
337
    return -1;
317
338
}
 
339
#endif  /* HAVE_LDAP */