~ubuntu-branches/debian/squeeze/netatalk/squeeze

« back to all changes in this revision

Viewing changes to etc/afpd/status.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2009-02-02 19:59:05 UTC
  • mfrom: (8.2.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090202195905-732t6wxk8jzsb91r
Tags: 2.0.4~beta2-4.1ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes: LP: #318665
  - Changed dependency from libdb-dev to libdb4.6-dev to correct
    FTBFS due to an issue caused by mismatches on installed binaries
    and development headers (db4.7 is installed under a different soname
    which breaks a check in netatalk) (LP: #262991)
  - debian/control:
    + Replace libltdl3-dev with libltdl7-dev.
    + Recommend db4.6-util instead of db4.2-util as we build netatalk with
      db4.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $Id: status.c,v 1.13.6.11.2.1 2005/01/31 19:50:38 didg Exp $
 
2
 * $Id: status.c,v 1.13.6.11.2.3 2006/09/18 00:23:58 didg Exp $
3
3
 *
4
4
 * Copyright (c) 1990,1993 Regents of The University of Michigan.
5
5
 * All Rights Reserved.  See COPYRIGHT.
36
36
#include "afp_config.h"
37
37
#include "icon.h"
38
38
 
39
 
static   int maxstatuslen = 0;
 
39
static   size_t maxstatuslen = 0;
40
40
 
41
41
static void status_flags(char *data, const int notif, const int ipok,
42
 
                         const unsigned char passwdbits, const int dirsrvcs)
 
42
                         const unsigned char passwdbits, const int dirsrvcs _U_)
43
43
{
44
44
    u_int16_t           status;
45
45
 
85
85
    nbp_name(server, &Obj, &Type, &Zone);
86
86
    if ((size_t)-1 == (len = convert_string( 
87
87
                        options->unixcharset, options->maccharset, 
88
 
                        Obj, strlen(Obj), buf, 31)) ) {
 
88
                        Obj, strlen(Obj), buf, sizeof(buf))) ) {
89
89
        len = MIN(strlen(Obj), 31);
90
90
        *data++ = len;
91
91
        memcpy( data, Obj, len );
228
228
    return sigoff;
229
229
}
230
230
 
231
 
static int status_netaddress(char *data, int *servoffset,
 
231
static size_t status_netaddress(char *data, int *servoffset,
232
232
                             const ASP asp, const DSI *dsi,
233
233
                             const struct afp_options *options)
234
234
{
282
282
 
283
283
    /* handle DNS names */
284
284
    if (options->fqdn && dsi) {
285
 
        int len = strlen(options->fqdn);
 
285
        size_t len = strlen(options->fqdn);
286
286
        if ( len + 2 + addresses_len < maxstatuslen - offset) {
287
287
            *data++ = len +2;
288
288
            *data++ = 0x04;
333
333
    return (data - begin);
334
334
}
335
335
 
336
 
static int status_directorynames(char *data, int *diroffset, 
337
 
                                 const DSI *dsi, 
 
336
static size_t status_directorynames(char *data, int *diroffset, 
 
337
                                 const DSI *dsi _U_, 
338
338
                                 const struct afp_options *options)
339
339
{
340
340
    char *begin = data;
352
352
     */
353
353
    if (options->k5service && options->k5realm && options->fqdn) {
354
354
        /* should k5princ be utf8 encoded? */
355
 
        u_int8_t len;
 
355
        size_t len;
356
356
        char *p = strchr( options->fqdn, ':' );
357
357
        if (p) 
358
358
            *p = '\0';
360
360
                        + strlen( options->fqdn )
361
361
                        + strlen( options->k5realm );
362
362
        len+=2; /* '/' and '@' */
363
 
        if ( len+2 > maxstatuslen - offset) {
 
363
        if ( len > 255 || len+2 > maxstatuslen - offset) {
364
364
            *data++ = 0;
365
365
            LOG ( log_error, logtype_afpd, "status: could not set directory service list, no more room");
366
366
        }        
386
386
    return (data - begin);
387
387
}
388
388
 
389
 
static int status_utf8servername(char *data, int *nameoffset,
390
 
                                 const DSI *dsi,
 
389
static size_t status_utf8servername(char *data, int *nameoffset,
 
390
                                 const DSI *dsi _U_,
391
391
                                 const struct afp_options *options)
392
392
{
393
393
    char *Obj, *Type, *Zone;
481
481
{
482
482
    ASP asp;
483
483
    DSI *dsi;
484
 
    u_int8_t *status = NULL;
485
 
    int statuslen, c, sigoff;
 
484
    char *status = NULL;
 
485
    size_t statuslen;
 
486
    int c, sigoff;
486
487
 
487
488
    if (!(aspconfig || dsiconfig) || !options)
488
489
        return;
570
571
 
571
572
/* this is the same as asp/dsi_getstatus */
572
573
int afp_getsrvrinfo(obj, ibuf, ibuflen, rbuf, rbuflen )
573
 
AFPObj      *obj;
574
 
char    *ibuf, *rbuf;
575
 
int             ibuflen, *rbuflen;
 
574
AFPObj  *obj;
 
575
char    *ibuf _U_, *rbuf;
 
576
int     ibuflen _U_, *rbuflen;
576
577
{
577
578
    AFPConfig *config = obj->config;
578
579