~ubuntu-branches/ubuntu/trusty/shadow/trusty-updates

« back to all changes in this revision

Viewing changes to debian/patches/userns/03_userns_implement_commonio_append

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs, Serge Hallyn
  • Date: 2013-06-28 11:31:51 UTC
  • Revision ID: package-import@ubuntu.com-20130628113151-9uapv6rwwj08whr7
Tags: 1:4.1.5.1-1ubuntu5
[ Serge Hallyn ]
* debian/patches/userns: patches from Eric Biederman to enable use of
  subuids, plus some bugfix patches on top of them. (LP: #1192864)
* passwd.install: add new manpages
* debian/control, debian/uidmap.install: create new uidmap package
  containing the new setuid-root binaries newuidmap and newgidmap 
* debian/subuid, debian/rules: install a default /etc/subuid and /etc/subgid
* debian/patches/userns/16_add-argument-sanity-checking.patch: address
  three sanity checking concerns brought up by sarnold at
  http://lists.alioth.debian.org/pipermail/pkg-shadow-devel/2013-June/ \
  009752.html.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From ebiederm@xmission.com  Tue Jan 22 09:15:19 2013
 
2
Return-Path: <ebiederm@xmission.com>
 
3
X-Original-To: serge@hallyn.com
 
4
Delivered-To: serge@hallyn.com
 
5
Received: by mail.hallyn.com (Postfix, from userid 5001)
 
6
        id CAFA8C80F6; Tue, 22 Jan 2013 09:15:19 +0000 (UTC)
 
7
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail
 
8
X-Spam-Level: 
 
9
X-Spam-Status: No, score=0.1 required=8.0 tests=BAD_ENC_HEADER,BAYES_00
 
10
        autolearn=no version=3.3.1
 
11
Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232])
 
12
        (using TLSv1 with cipher AES256-SHA (256/256 bits))
 
13
        (No client certificate requested)
 
14
        by mail.hallyn.com (Postfix) with ESMTPS id 43FAEC80D1
 
15
        for <serge@hallyn.com>; Tue, 22 Jan 2013 09:15:15 +0000 (UTC)
 
16
Received: from in02.mta.xmission.com ([166.70.13.52])
 
17
        by out02.mta.xmission.com with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 
18
        (Exim 4.76)
 
19
        (envelope-from <ebiederm@xmission.com>)
 
20
        id 1TxZvA-0006sA-Pq; Tue, 22 Jan 2013 02:13:32 -0700
 
21
Received: from c-98-207-153-68.hsd1.ca.comcast.net ([98.207.153.68] helo=eric-ThinkPad-X220.xmission.com)
 
22
        by in02.mta.xmission.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
 
23
        (Exim 4.76)
 
24
        (envelope-from <ebiederm@xmission.com>)
 
25
        id 1TxZv8-0004VI-Fi; Tue, 22 Jan 2013 02:13:32 -0700
 
26
From: ebiederm@xmission.com (Eric W. Biederman)
 
27
To: Nicolas =?utf-8?Q?Fran=C3=A7ois?= <nicolas.francois@centraliens.net>
 
28
Cc: <Pkg-shadow-devel@lists.alioth.debian.org>,  Linux Containers <containers@lists.linux-foundation.org>,  "Michael Kerrisk \(man-pages\)" <mtk.manpages@gmail.com>,  "Serge E. Hallyn" <serge@hallyn.com>
 
29
References: <87d2wxshu0.fsf@xmission.com>
 
30
Date: Tue, 22 Jan 2013 01:13:26 -0800
 
31
In-Reply-To: <87d2wxshu0.fsf@xmission.com> (Eric W. Biederman's message of
 
32
        "Tue, 22 Jan 2013 01:11:19 -0800")
 
33
Message-ID: <87vcapr361.fsf@xmission.com>
 
34
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)
 
35
MIME-Version: 1.0
 
36
Content-Type: text/plain
 
37
X-XM-AID: U2FsdGVkX1++0A/mQBimfZkeNedO095IfnCYGQfIolI=
 
38
X-SA-Exim-Connect-IP: 98.207.153.68
 
39
X-SA-Exim-Mail-From: ebiederm@xmission.com
 
40
Subject: [PATCH 03/11] Implement commonio_append.
 
41
X-SA-Exim-Version: 4.2.1 (built Wed, 14 Nov 2012 14:26:46 -0700)
 
42
X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com)
 
43
X-UID: 2073                                                  
 
44
Status: RO
 
45
Content-Length: 1874
 
46
Lines: 65
 
47
 
 
48
 
 
49
To support files that do not have a simple unique key implement
 
50
commonio_append to allow new entries to be added.
 
51
 
 
52
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
 
53
---
 
54
 lib/commonio.c |   30 ++++++++++++++++++++++++++++++
 
55
 lib/commonio.h |    1 +
 
56
 2 files changed, 31 insertions(+), 0 deletions(-)
 
57
 
 
58
Index: shadow/lib/commonio.c
 
59
===================================================================
 
60
--- shadow.orig/lib/commonio.c  2013-02-01 15:27:51.376080384 -0600
 
61
+++ shadow/lib/commonio.c       2013-02-01 15:27:51.368080384 -0600
 
62
@@ -1121,6 +1121,36 @@
 
63
        return 1;
 
64
 }
 
65
 
 
66
+int commonio_append (struct commonio_db *db, const void *eptr)
 
67
+{
 
68
+       struct commonio_entry *p;
 
69
+       void *nentry;
 
70
+
 
71
+       if (!db->isopen || db->readonly) {
 
72
+               errno = EINVAL;
 
73
+               return 0;
 
74
+       }
 
75
+       nentry = db->ops->dup (eptr);
 
76
+       if (NULL == nentry) {
 
77
+               errno = ENOMEM;
 
78
+               return 0;
 
79
+       }
 
80
+       /* new entry */
 
81
+       p = (struct commonio_entry *) malloc (sizeof *p);
 
82
+       if (NULL == p) {
 
83
+               db->ops->free (nentry);
 
84
+               errno = ENOMEM;
 
85
+               return 0;
 
86
+       }
 
87
+
 
88
+       p->eptr = nentry;
 
89
+       p->line = NULL;
 
90
+       p->changed = true;
 
91
+       add_one_entry (db, p);
 
92
+
 
93
+       db->changed = true;
 
94
+       return 1;
 
95
+}
 
96
 
 
97
 void commonio_del_entry (struct commonio_db *db, const struct commonio_entry *p)
 
98
 {
 
99
Index: shadow/lib/commonio.h
 
100
===================================================================
 
101
--- shadow.orig/lib/commonio.h  2013-02-01 15:27:51.376080384 -0600
 
102
+++ shadow/lib/commonio.h       2013-02-01 15:27:51.368080384 -0600
 
103
@@ -146,6 +146,7 @@
 
104
 extern int commonio_open (struct commonio_db *, int);
 
105
 extern /*@observer@*/ /*@null@*/const void *commonio_locate (struct commonio_db *, const char *);
 
106
 extern int commonio_update (struct commonio_db *, const void *);
 
107
+extern int commonio_append (struct commonio_db *, const void *);
 
108
 extern int commonio_remove (struct commonio_db *, const char *);
 
109
 extern int commonio_rewind (struct commonio_db *);
 
110
 extern /*@observer@*/ /*@null@*/const void *commonio_next (struct commonio_db *);