~ubuntu-branches/ubuntu/lucid/nfs-utils/lucid

« back to all changes in this revision

Viewing changes to support/export/client.c

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2006-07-03 10:36:59 UTC
  • mto: (12.1.1 feisty)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20060703103659-71qzs6f21zzmjmhx
Tags: upstream-1.0.8
ImportĀ upstreamĀ versionĀ 1.0.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
7
7
 */
8
8
 
9
 
#include "config.h"
 
9
#ifdef HAVE_CONFIG_H
 
10
#include <config.h>
 
11
#endif
10
12
 
11
13
#include <sys/types.h>
12
14
#include <netinet/in.h>
138
140
 
139
141
        if (clp->m_type == MCL_SUBNETWORK) {
140
142
                char    *cp = strchr(clp->m_hostname, '/');
 
143
                static char slash32[] = "/32";
141
144
 
 
145
                if(!cp) cp = slash32;
142
146
                *cp = '\0';
143
147
                clp->m_addrlist[0].s_addr = inet_addr(clp->m_hostname);
144
148
                if (strchr(cp + 1, '.')) {
260
264
        return name;
261
265
}
262
266
 
263
 
int 
 
267
int
264
268
client_member(char *client, char *name)
265
269
{
266
270
        /* check if "client" (a ',' separated list of names)
267
 
         * contains 'name' as a member 
 
271
         * contains 'name' as a member
268
272
         */
269
273
        int l = strlen(name);
270
274
        while (*client) {
280
284
}
281
285
 
282
286
 
283
 
int 
 
287
int
284
288
name_cmp(char *a, char *b)
285
289
{
286
290
        /* compare strings a and b, but only upto ',' in a */
443
447
                if (*sp == '\\' && sp[1])
444
448
                        sp++;
445
449
        }
446
 
        return MCL_FQDN;
 
450
        /* check for N.N.N.N */
 
451
        sp = ident;
 
452
        if(!isdigit(*sp) || strtoul(sp, &sp, 10) > 255 || *sp != '.') return MCL_FQDN;
 
453
        sp++; if(!isdigit(*sp) || strtoul(sp, &sp, 10) > 255 || *sp != '.') return MCL_FQDN;
 
454
        sp++; if(!isdigit(*sp) || strtoul(sp, &sp, 10) > 255 || *sp != '.') return MCL_FQDN;
 
455
        sp++; if(!isdigit(*sp) || strtoul(sp, &sp, 10) > 255 || *sp != '\0') return MCL_FQDN;
 
456
        /* we lie here a bit. but technically N.N.N.N == N.N.N.N/32 :) */
 
457
        return MCL_SUBNETWORK;
447
458
}