Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
60534f79
Unverified
Commit
60534f79
authored
Mar 23, 2018
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pam: Fix missing symbols in module
Signed-off-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
parent
1b849a8f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
152 additions
and
1 deletion
+152
-1
Makefile.am
src/lxc/Makefile.am
+1
-1
utils.c
src/lxc/pam/utils.c
+108
-0
utils.h
src/lxc/pam/utils.h
+43
-0
No files found.
src/lxc/Makefile.am
View file @
60534f79
...
@@ -306,7 +306,7 @@ endif
...
@@ -306,7 +306,7 @@ endif
if
ENABLE_PAM
if
ENABLE_PAM
if
HAVE_PAM
if
HAVE_PAM
pam_LTLIBRARIES
=
pam_cgfs.la
pam_LTLIBRARIES
=
pam_cgfs.la
pam_cgfs_la_SOURCES
=
pam/pam_cgfs.c
pam_cgfs_la_SOURCES
=
pam/pam_cgfs.c
pam/utils.c pam/utils.h
pam_cgfs_la_CFLAGS
=
$(AM_CFLAGS)
pam_cgfs_la_CFLAGS
=
$(AM_CFLAGS)
pam_cgfs_la_LIBADD
=
$(AM_LIBS)
$(PAM_LIBS)
-L
$(top_srcdir)
pam_cgfs_la_LIBADD
=
$(AM_LIBS)
$(PAM_LIBS)
-L
$(top_srcdir)
pam_cgfs_la_LDFLAGS
=
$(AM_LDFLAGS)
-module
-avoid-version
-shared
pam_cgfs_la_LDFLAGS
=
$(AM_LDFLAGS)
-module
-avoid-version
-shared
...
...
src/lxc/pam/utils.c
0 → 100644
View file @
60534f79
/*
* lxc: linux Container library
*
* (C) Copyright IBM Corp. 2007, 2008
*
* Authors:
* Daniel Lezcano <daniel.lezcano at free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <sys/vfs.h>
#include <stdarg.h>
#include "utils.h"
bool
file_exists
(
const
char
*
f
)
{
struct
stat
statbuf
;
return
stat
(
f
,
&
statbuf
)
==
0
;
}
void
*
must_realloc
(
void
*
orig
,
size_t
sz
)
{
void
*
ret
;
do
{
ret
=
realloc
(
orig
,
sz
);
}
while
(
!
ret
);
return
ret
;
}
char
*
must_copy_string
(
const
char
*
entry
)
{
char
*
ret
;
if
(
!
entry
)
return
NULL
;
do
{
ret
=
strdup
(
entry
);
}
while
(
!
ret
);
return
ret
;
}
char
*
must_make_path
(
const
char
*
first
,
...)
{
va_list
args
;
char
*
cur
,
*
dest
;
size_t
full_len
=
strlen
(
first
);
dest
=
must_copy_string
(
first
);
va_start
(
args
,
first
);
while
((
cur
=
va_arg
(
args
,
char
*
))
!=
NULL
)
{
full_len
+=
strlen
(
cur
);
if
(
cur
[
0
]
!=
'/'
)
full_len
++
;
dest
=
must_realloc
(
dest
,
full_len
+
1
);
if
(
cur
[
0
]
!=
'/'
)
strcat
(
dest
,
"/"
);
strcat
(
dest
,
cur
);
}
va_end
(
args
);
return
dest
;
}
bool
is_fs_type
(
const
struct
statfs
*
fs
,
fs_type_magic
magic_val
)
{
return
(
fs
->
f_type
==
(
fs_type_magic
)
magic_val
);
}
bool
has_fs_type
(
const
char
*
path
,
fs_type_magic
magic_val
)
{
bool
has_type
;
int
ret
;
struct
statfs
sb
;
ret
=
statfs
(
path
,
&
sb
);
if
(
ret
<
0
)
return
false
;
has_type
=
is_fs_type
(
&
sb
,
magic_val
);
return
has_type
;
}
src/lxc/pam/utils.h
0 → 100644
View file @
60534f79
/*
* lxc: linux Container library
*
* (C) Copyright IBM Corp. 2007, 2008
*
* Authors:
* Daniel Lezcano <daniel.lezcano at free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __PAM_UTILS_H
#define __PAM_UTILS_H
#include <sys/vfs.h>
#ifndef CGROUP_SUPER_MAGIC
#define CGROUP_SUPER_MAGIC 0x27e0eb
#endif
#ifndef CGROUP2_SUPER_MAGIC
#define CGROUP2_SUPER_MAGIC 0x63677270
#endif
typedef
__typeof__
(((
struct
statfs
*
)
NULL
)
->
f_type
)
fs_type_magic
;
extern
bool
file_exists
(
const
char
*
f
);
extern
void
*
must_realloc
(
void
*
orig
,
size_t
sz
);
extern
char
*
must_copy_string
(
const
char
*
entry
);
__attribute__
((
sentinel
))
extern
char
*
must_make_path
(
const
char
*
first
,
...);
extern
bool
has_fs_type
(
const
char
*
path
,
fs_type_magic
magic_val
);
#endif
/* __PAM_UTILS_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment