~ubuntu-branches/debian/sid/netatalk/sid

« back to all changes in this revision

Viewing changes to etc/cnid_dbd/pack.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: pack.c,v 1.6 2009-10-13 22:55:37 didg Exp $
3
 
 *
4
2
 * Copyright (C) Joerg Lenneis 2003
 
3
 * Copyright (C) Frank Lahm 2010
5
4
 * All Rights Reserved.  See COPYING.
6
5
 */
7
6
 
12
11
#include <netatalk/endian.h>
13
12
 
14
13
#include <string.h>
15
 
#ifdef HAVE_SYS_TYPES_H
16
 
#include <sys/types.h>
17
 
#endif /* HAVE_SYS_TYPES_H */
 
14
#include <inttypes.h>
18
15
#include <sys/param.h>
19
16
#include <sys/cdefs.h>
20
17
#include <db.h>
21
18
 
 
19
#include <atalk/unicode.h>
 
20
#include <atalk/volinfo.h>
 
21
#include <atalk/logger.h>
22
22
#include <atalk/cnid_dbd_private.h>
23
23
#include "pack.h"
24
24
 
 
25
/* in main.c for `cnid_dbd` or cmd_dbd.c for `dbd` */
 
26
extern struct volinfo volinfo;
 
27
 
25
28
/* --------------- */
26
29
/*
27
30
 *  This implementation is portable, but could probably be faster by using htonl
72
75
    return (0);
73
76
}
74
77
 
 
78
/* --------------- */
 
79
int idxname(DB *dbp _U_, const DBT *pkey _U_,  const DBT *pdata, DBT *skey)
 
80
{
 
81
    static char buffer[MAXPATHLEN +2];
 
82
    uint16_t flags = CONV_TOLOWER;
 
83
    memset(skey, 0, sizeof(DBT));
 
84
 
 
85
    if (convert_charset(volinfo.v_volcharset,
 
86
                        volinfo.v_volcharset,
 
87
                        volinfo.v_maccharset,
 
88
                        (char *)pdata->data + CNID_NAME_OFS,
 
89
                        strlen((char *)pdata->data + CNID_NAME_OFS),
 
90
                        buffer,
 
91
                        MAXPATHLEN,
 
92
                        &flags) == (size_t)-1) {
 
93
        LOG(log_error, logtype_cnid, "idxname: conversion error");
 
94
    }
 
95
 
 
96
    skey->data = buffer;
 
97
    skey->size = strlen(skey->data);
 
98
    return (0);
 
99
}
 
100
 
75
101
/* The equivalent to make_cnid_data in the cnid library. Non re-entrant. We
76
102
   differ from make_cnid_data in that we never return NULL, rqst->name cannot
77
103
   ever cause start[] to overflow because name length is checked in libatalk. */