~ubuntu-branches/ubuntu/trusty/isdnutils/trusty

« back to all changes in this revision

Viewing changes to eurofile/src/wuauth/acl.c

  • Committer: Package Import Robot
  • Author(s): Steve Langasek
  • Date: 2013-11-15 00:02:58 UTC
  • mfrom: (1.1.8) (31.1.1 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20131115000258-tt9v3gasgrdml07k
Tags: 1:3.25+dfsg1-3.3ubuntu1
* Merge from Debian unstable:
  - resolves licensing issues with package contents.  LP: #511988.
  - includes proper upstream fix for ipppd on ARM.  LP: #453159.
  - resolves isdnutils-base removal failures.  LP: #813771.
  - fixes capiutils init script to not try to mount obsolete capifs.
    LP: #1064347.
* Remaining changes:
  - Switch libreadline5-dev to libreadline-gplv2-dev since this package
    appears to be GPLv2
  - debian/patches/no-imake.patch: Don't build xisdnload/xmonisdn using
    xmkmf/imake.  This patch was dropped in Debian without explanation;
    it still applies and seems to still be a good idea for eventual
    upstreaming, since imake is quite obsolete.
  - capi.conf: Fix typo for fcdsl2 firmware. LP: #189132.
  - Remove dependencies on /etc/inittab.
    - Disable the installation code to modify /etc/inittab.
    - isdnutils-base: Add ttyI0 example script, which needs to be installed
      in /etc/event.d/ttyI0.
    - isdnvboxserver: Add ttyI1 example script, which needs to be installed
      in /etc/event.d/ttyI1.
    - The two upstart scripts need to be edited.
    - Further improvements and documentation welcome.
* Changes included in Debian:
  - replace calls to ./MAKEDEV with /sbin/MAKEDEV
  - Build-depend on ppp-dev.
  - Switch to newer tcl -dev.
  - update to newer automake
  - debian/rules: use autoreconf to update the autotools in the capi20
    directory
  - debian/{compat,rules,*.files,.dirs}: Convert to Multi-arch.
  - debian/libcapi20-dev.install: Remove .la files (no builds use them).
* Changes included upstream:
  - fix for ARM FTBFS.
  - fix bashisms in vboxplay.
  - debian/patches/{config_libdir,toplevel-make}.patch: add CONFIG_LIBDIR
    override to upstream build system to support Multi-arch.
* Dropped changes:
  - kick dpatch to the curb.
* Handle migrating the blacklist file from
  /etc/modprobe.d/blacklist-capiutils.conf to the path used in Debian,
  /etc/modprobe.d/capiutils.conf.
* Handle rename of /etc/ppp/ip-down.d/99-ipppd and /etc/ppp/ip-up.d/00-ipppd
  to /etc/ppp/ip-down.d/ipppd and /etc/ppp/ip-up.d/ipppd
* Handle rename of /etc/init.d/isdnutils to /etc/init.d/isdnutils-base
* Restore standard.tcl to /usr/share/isdnvboxserver/default; maintainer
  scripts must not depend on contents of /usr/share/doc.
* Apply patches that were preserved in the 3.0 (quilt) migration, but
  were inadvertently not applied:
  - debian/patches/capifax.additional_error_codes.patch
  - debian/patches/capifax.3_1kHz_audio.patch
* Drop debian/isdnutils-base.cron.d, which isn't a cronjob example at all
  but an inittab example gone astray.
* debian/dotconfig*: don't use embedded quotes for paths; this confuses
  vbox's Makefiles something fierce, and causes files to be missed from
  debian/tmp'/usr/share/man/' at install time.
* Fix isdnlog and ipppd to not ship files used in the postinst under
  /usr/share/doc.
* Modernize the upstart examples.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 1993, 1994  Washington University in Saint Louis
2
 
 * All rights reserved.
3
 
 *
4
 
 * Redistribution and use in source and binary forms, with or without
5
 
 * modification, are permitted provided that the following conditions are
6
 
 * met: 1. Redistributions of source code must retain the above copyright
7
 
 * notice, this list of conditions and the following disclaimer. 2.
8
 
 * Redistributions in binary form must reproduce the above copyright notice,
9
 
 * this list of conditions and the following disclaimer in the documentation
10
 
 * and/or other materials provided with the distribution. 3. All advertising
11
 
 * materials mentioning features or use of this software must display the
12
 
 * following acknowledgement: This product includes software developed by the
13
 
 * Washington University in Saint Louis and its contributors. 4. Neither the
14
 
 * name of the University nor the names of its contributors may be used to
15
 
 * endorse or promote products derived from this software without specific
16
 
 * prior written permission.
17
 
 *
18
 
 * THIS SOFTWARE IS PROVIDED BY WASHINGTON UNIVERSITY AND CONTRIBUTORS
19
 
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
 
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
 
 * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASHINGTON
22
 
 * UNIVERSITY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23
 
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24
 
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25
 
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
 
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
 
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
 
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
 
 * POSSIBILITY OF SUCH DAMAGE.
30
 
 */
31
 
 
32
 
#ifndef lint
33
 
char * rcsid = "$Id: acl.c,v 1.2 1999/10/05 21:23:23 he Exp $";
34
 
#endif
35
 
#include "config.h"
36
 
 
37
 
#include <stdio.h>
38
 
#include <errno.h>
39
 
#include <string.h>
40
 
#ifdef SYSSYSLOG
41
 
#include <sys/syslog.h>
42
 
#else
43
 
#include <syslog.h>
44
 
#endif
45
 
 
46
 
#include <sys/types.h>
47
 
#include <sys/stat.h>
48
 
#include <sys/file.h>
49
 
 
50
 
#include "pathnames.h"
51
 
#include "extensions.h"
52
 
 
53
 
char *aclbuf = NULL;
54
 
static struct aclmember *aclmembers;
55
 
 
56
 
/*************************************************************************/
57
 
/* FUNCTION  : getaclentry                                               */
58
 
/* PURPOSE   : Retrieve a named entry from the ACL                       */
59
 
/* ARGUMENTS : pointer to the keyword and a handle to the acl members    */
60
 
/* RETURNS   : pointer to the acl member containing the keyword or NULL  */
61
 
/*************************************************************************/
62
 
 
63
 
struct aclmember *
64
 
#ifdef __STDC__
65
 
getaclentry(char *keyword, struct aclmember **next)
66
 
#else
67
 
getaclentry(keyword,next)
68
 
char *keyword;
69
 
struct aclmember **next;
70
 
#endif
71
 
{
72
 
    do {
73
 
        if (!*next)
74
 
            *next = aclmembers;
75
 
        else
76
 
            *next = (*next)->next;
77
 
    } while (*next && strcmp((*next)->keyword, keyword));
78
 
 
79
 
    return (*next);
80
 
}
81
 
 
82
 
/*************************************************************************/
83
 
/* FUNCTION  : parseacl                                                  */
84
 
/* PURPOSE   : Parse the acl buffer into its components                  */
85
 
/* ARGUMENTS : A pointer to the acl file                                 */
86
 
/* RETURNS   : != 0 if error is detected                                 */
87
 
/*************************************************************************/
88
 
 
89
 
int
90
 
#ifdef __STDC__
91
 
parseacl(void)
92
 
#else
93
 
parseacl()
94
 
#endif
95
 
{
96
 
    char *ptr,
97
 
     *aclptr = aclbuf,
98
 
     *line;
99
 
    int cnt;
100
 
    struct aclmember *member,
101
 
     *acltail;
102
 
 
103
 
    if (!aclbuf || !(*aclbuf))
104
 
        return 1;
105
 
 
106
 
    aclmembers = (struct aclmember *) NULL;
107
 
    acltail = (struct aclmember *) NULL;
108
 
 
109
 
    while (*aclptr != '\0') {
110
 
        line = aclptr;
111
 
        while (*aclptr && *aclptr != '\n')
112
 
            aclptr++;
113
 
        *aclptr++ = (char) NULL;
114
 
 
115
 
        /* deal with comments */
116
 
        if ((ptr = strchr(line, '#')) != NULL)
117
 
            /* allowed escaped '#' chars for path-filter (DiB) */
118
 
            if (*(ptr-1) != '\\')
119
 
                *ptr = '\0';
120
 
 
121
 
        ptr = strtok(line, " \t");
122
 
        if (ptr) {
123
 
            member = (struct aclmember *) calloc(1, sizeof(struct aclmember));
124
 
 
125
 
            (void) strcpy(member->keyword, ptr);
126
 
            cnt = 0;
127
 
            while ((ptr = strtok(NULL, " \t")) != NULL) {
128
 
                if (cnt >= MAXARGS) {
129
 
                    syslog(LOG_ERR,
130
 
                        "Too many args (>%d) in ftpaccess: %s %s %s %s %s ...",
131
 
                        MAXARGS - 1, member->keyword, member->arg[0],
132
 
                        member->arg[1], member->arg[2], member->arg[3]);
133
 
                    break;
134
 
                }
135
 
                member->arg[cnt++] = ptr;
136
 
            }
137
 
            if (acltail)
138
 
                acltail->next = member;
139
 
            acltail = member;
140
 
            if (!aclmembers)
141
 
                aclmembers = member;
142
 
        }
143
 
    }
144
 
    return 0;
145
 
}
146
 
 
147
 
/*************************************************************************/
148
 
/* FUNCTION  : readacl                                                   */
149
 
/* PURPOSE   : Read the acl into memory                                  */
150
 
/* ARGUMENTS : The pathname of the acl                                   */
151
 
/* RETURNS   : 0 if error, 1 if no error                                 */
152
 
/*************************************************************************/
153
 
 
154
 
int
155
 
#ifdef __STDC__
156
 
readacl(char *aclpath)
157
 
#else
158
 
readacl(aclpath)
159
 
char *aclpath;
160
 
#endif
161
 
{
162
 
    FILE *aclfile;
163
 
    struct stat finfo;
164
 
    extern int use_accessfile;
165
 
 
166
 
    if (!use_accessfile)
167
 
        return (0);
168
 
 
169
 
    if ((aclfile = fopen(aclpath, "r")) == NULL) {
170
 
        syslog(LOG_ERR, "cannot open access file %s: %s", aclpath,
171
 
               strerror(errno));
172
 
        return (0);
173
 
    }
174
 
    if (fstat(fileno(aclfile), &finfo) != 0) {
175
 
        syslog(LOG_ERR, "cannot fstat access file %s: %s", aclpath,
176
 
               strerror(errno));
177
 
        (void) fclose(aclfile);
178
 
        return (0);
179
 
    }
180
 
    if (finfo.st_size == 0) {
181
 
        aclbuf = (char *) calloc(1, 1);
182
 
    } else {
183
 
        if (!(aclbuf = (char *)malloc((unsigned) finfo.st_size + 1))) {
184
 
            syslog(LOG_ERR, "could not malloc aclbuf (%d bytes)", finfo.st_size + 1);
185
 
            (void) fclose(aclfile);
186
 
            return (0);
187
 
        }
188
 
        if (!fread(aclbuf, (size_t) finfo.st_size, 1, aclfile)) {
189
 
            syslog(LOG_ERR, "error reading acl file %s: %s", aclpath,
190
 
                   strerror(errno));
191
 
            aclbuf = NULL;
192
 
            (void) fclose(aclfile);
193
 
            return (0);
194
 
        }
195
 
        *(aclbuf + finfo.st_size) = '\0';
196
 
    }
197
 
    (void) fclose(aclfile);
198
 
    return (1);
199
 
}
200