1
Description: libapparmor: Make aa_getpeercon_raw() similar to
4
The parameter names are slightly different in the two functions. Rename
5
buffer to buf and rename size to len to make the two function prototypes
8
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
9
Acked-by: Seth Arnold <seth.arnold@canonical.com>
10
Origin: commit, revision id: tyhicks@canonical.com-20130625225508-00ax5w3r1aa22c3e
11
Author: Tyler Hicks <tyhicks@canonical.com>
12
Last-Update: 2013-06-25
13
X-Bzr-Revision-Id: tyhicks@canonical.com-20130625225508-00ax5w3r1aa22c3e
15
=== modified file 'libraries/libapparmor/src/apparmor.h'
16
--- old/libraries/libapparmor/src/apparmor.h 2013-06-25 22:54:17 +0000
17
+++ new/libraries/libapparmor/src/apparmor.h 2013-06-25 22:55:08 +0000
19
extern int aa_getprocattr(pid_t tid, const char *attr, char **buf, char **mode);
20
extern int aa_gettaskcon(pid_t target, char **con, char **mode);
21
extern int aa_getcon(char **con, char **mode);
22
-extern int aa_getpeercon_raw(int fd, char *buffer, int *size, char **mode);
23
+extern int aa_getpeercon_raw(int fd, char *buf, int *len, char **mode);
24
extern int aa_getpeercon(int fd, char **con, char **mode);
26
#define __macroarg_counter(Y...) __macroarg_count1 ( , ##Y)
28
=== modified file 'libraries/libapparmor/src/kernel_interface.c'
29
--- old/libraries/libapparmor/src/kernel_interface.c 2013-06-25 22:54:17 +0000
30
+++ new/libraries/libapparmor/src/kernel_interface.c 2013-06-25 22:55:08 +0000
33
* aa_getpeercon_raw - get the confinement of the socket's peer (other end)
34
* @fd: socket to get peer confinement for
35
- * @con: pointer to buffer to store confinement string
36
- * @size: initially contains size of the buffer, returns size of data read
37
+ * @buf: buffer to store the result in
38
+ * @len: initially contains size of the buffer, returns size of data read
39
* @mode: if set will point to mode string within buffer if it is present
41
* Returns: length of confinement data including null termination or -1 on error
42
- * if errno == ERANGE then @size will hold the size needed
43
+ * if errno == ERANGE then @len will hold the size needed
45
-int aa_getpeercon_raw(int fd, char *buffer, int *size, char **mode)
46
+int aa_getpeercon_raw(int fd, char *buf, int *len, char **mode)
48
- socklen_t optlen = *size;
49
+ socklen_t optlen = *len;
53
- if (optlen <= 0 || buffer == NULL) {
54
+ if (optlen <= 0 || buf == NULL) {
59
- rc = getsockopt(fd, SOL_SOCKET, SO_PEERSEC, buffer, &optlen);
60
+ rc = getsockopt(fd, SOL_SOCKET, SO_PEERSEC, buf, &optlen);
61
if (rc == -1 || optlen <= 0)
64
/* check for null termination */
65
- if (buffer[optlen - 1] != 0) {
66
- if (optlen < *size) {
68
+ if (buf[optlen - 1] != 0) {
69
+ if (optlen < *len) {
73
- /* buffer needs to be bigger by 1 */
74
+ /* buf needs to be bigger by 1 */
82
- mode_str = parse_confinement_mode(buffer, optlen);
83
+ mode_str = parse_confinement_mode(buf, optlen);
95
=== modified file 'libraries/libapparmor/swig/SWIG/libapparmor.i'
96
--- old/libraries/libapparmor/swig/SWIG/libapparmor.i 2013-06-25 22:54:17 +0000
97
+++ new/libraries/libapparmor/swig/SWIG/libapparmor.i 2013-06-25 22:55:08 +0000
99
extern int aa_getprocattr(pid_t tid, const char *attr, char **buf, char **mode);
100
extern int aa_gettaskcon(pid_t target, char **con, char **mode);
101
extern int aa_getcon(char **con, char **mode);
102
-extern int aa_getpeercon_raw(int fd, char *buffer, int *size, char **mode);
103
+extern int aa_getpeercon_raw(int fd, char *buf, int *len, char **mode);
104
extern int aa_getpeercon(int fd, char **con, char **mode);