Mercurial > trustbridge
annotate cinst/nssstore_linux.c @ 1124:fd2194295218
(issue54) Start application after update in tray mode
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 17 Sep 2014 12:11:57 +0200 |
parents | 317ee9dc4684 |
children | e210ecc32d69 |
rev | line source |
---|---|
404 | 1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=2) | |
5 * and comes with ABSOLUTELY NO WARRANTY! | |
6 * See LICENSE.txt for details. | |
7 */ | |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
8 #ifndef WIN32 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
9 |
321
824ef90a6721
Move is_elevated into common/util.c file for better reuse
Andre Heinecke <aheinecke@intevation.de>
parents:
305
diff
changeset
|
10 /* @file |
824ef90a6721
Move is_elevated into common/util.c file for better reuse
Andre Heinecke <aheinecke@intevation.de>
parents:
305
diff
changeset
|
11 @brief Linux implementation of nssstore process control. |
824ef90a6721
Move is_elevated into common/util.c file for better reuse
Andre Heinecke <aheinecke@intevation.de>
parents:
305
diff
changeset
|
12 */ |
824ef90a6721
Move is_elevated into common/util.c file for better reuse
Andre Heinecke <aheinecke@intevation.de>
parents:
305
diff
changeset
|
13 |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
14 #include <stdbool.h> |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
15 #include <stdio.h> |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
16 #include <unistd.h> |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
17 #include <sys/types.h> |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
18 #include <sys/wait.h> |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
19 #include <string.h> |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
20 #include <stdlib.h> |
383
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
21 #include <limits.h> |
439
c88090a15ae4
Fix cinstprocesstest for new arguments. Handle errno on write errors
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
22 #include <errno.h> |
648
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
23 #include <pwd.h> |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
24 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
25 #include "nssstore.h" |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
26 #include "logging.h" |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
27 #include "strhelp.h" |
841
216a65d7fc4b
(issue66) Implement is_system_install and use it
Andre Heinecke <andre.heinecke@intevation.de>
parents:
648
diff
changeset
|
28 #include "util.h" |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
29 |
383
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
30 #define NSS_PROCESS_NAME "mozilla" |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
31 |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
32 |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
33 /**@brief Start the process to install / remove |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
34 * |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
35 * This forks the process and executes the NSS installation |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
36 * process. It also writes the Instructions to that process. |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
37 * |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
38 * @param [in] to_install strv of DER encoded certificates to be added. |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
39 * @param [in] to_remove strv of DER encoded certificates to be remvoed. |
1053
78798d3af8f0
Fixed doxygen build warnings.
Emanuel Schuetze <emanuel@intevation.de>
parents:
975
diff
changeset
|
40 * @param [in] uid uid of the user to install certificates for. |
78798d3af8f0
Fixed doxygen build warnings.
Emanuel Schuetze <emanuel@intevation.de>
parents:
975
diff
changeset
|
41 * @param [in] gid the gid of the user to install certificates for. |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
42 * @param [in] homedir the homedir of the user. |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
43 * |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
44 * @returns childs pid on success. -1 on failure |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
45 */ |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
46 static int |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
47 start_procces_for_user (char **to_install, char **to_remove, |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
48 uid_t uid, gid_t gid, char *homedir) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
49 { |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
50 int pipe_fd[2]; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
51 pid_t pid = 0; |
1060
317ee9dc4684
(issue46) Make debug output optional in cinst and mozilla and propagate its setting.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1053
diff
changeset
|
52 char *argv[3] = {NULL, NULL, NULL}, |
905
698b6a9bd75e
Fix coding style for C code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
841
diff
changeset
|
53 *envp[2] = {NULL, NULL}, |
698b6a9bd75e
Fix coding style for C code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
841
diff
changeset
|
54 *inst_dir = NULL; |
383
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
55 size_t homedir_len = 0, |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
56 exe_path_len = 0; |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
57 int ret = -1, |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
58 i = 0; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
59 FILE *stream = NULL; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
60 bool success = false; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
61 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
62 if (homedir == NULL) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
63 { |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
64 ERRORPRINTF ("Invalid call to start_process_for_user\n"); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
65 return -1; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
66 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
67 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
68 homedir_len = strlen (homedir); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
69 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
70 /* Allocate space for HOME=homedir\0 */ |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
71 envp[0] = xmalloc (homedir_len + 6); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
72 envp[1] = NULL; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
73 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
74 ret = snprintf (envp[0], homedir_len + 6, "HOME=%s", homedir); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
75 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
76 if (ret < 0 || (size_t) ret != homedir_len + 5) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
77 { |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
78 ERRORPRINTF ("Error setting home env variable.\n"); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
79 xfree (envp[0]); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
80 return -1; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
81 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
82 |
383
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
83 /* Set up the file name of the installer process */ |
841
216a65d7fc4b
(issue66) Implement is_system_install and use it
Andre Heinecke <andre.heinecke@intevation.de>
parents:
648
diff
changeset
|
84 inst_dir = get_install_dir(); |
383
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
85 if (inst_dir == NULL) |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
86 { |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
87 ERRORPRINTF ("Failed to find installation directory.\n"); |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
88 xfree (envp[0]); |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
89 return -1; |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
90 } |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
91 |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
92 exe_path_len = strlen(inst_dir) + strlen(NSS_PROCESS_NAME); |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
93 argv[0] = xmalloc (exe_path_len + 1); |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
94 |
1060
317ee9dc4684
(issue46) Make debug output optional in cinst and mozilla and propagate its setting.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1053
diff
changeset
|
95 if (g_debug) |
317ee9dc4684
(issue46) Make debug output optional in cinst and mozilla and propagate its setting.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1053
diff
changeset
|
96 { |
317ee9dc4684
(issue46) Make debug output optional in cinst and mozilla and propagate its setting.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1053
diff
changeset
|
97 argv[1] = "--debug"; |
317ee9dc4684
(issue46) Make debug output optional in cinst and mozilla and propagate its setting.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1053
diff
changeset
|
98 } |
317ee9dc4684
(issue46) Make debug output optional in cinst and mozilla and propagate its setting.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1053
diff
changeset
|
99 |
383
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
100 ret = snprintf(argv[0], exe_path_len + 1, "%s%s", inst_dir, NSS_PROCESS_NAME); |
947
dbf5ea18cb20
Free the get_install_dir return value.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
905
diff
changeset
|
101 xfree (inst_dir); |
383
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
102 if (ret < 0 || (size_t) ret != exe_path_len) |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
103 { |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
104 ERRORPRINTF ("Error setting executable variable.\n"); |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
105 xfree (argv[0]); |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
106 return -1; |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
107 } |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
108 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
109 if (pipe (pipe_fd)) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
110 { |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
111 ERRORPRINTF ("Failed to create pipe.\n"); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
112 return -1; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
113 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
114 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
115 pid = fork(); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
116 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
117 if (pid == (pid_t) -1) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
118 { |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
119 ERRORPRINTF ("Failed to fork child.\n"); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
120 return -1; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
121 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
122 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
123 if (pid == (pid_t) 0) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
124 { |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
125 /* Drop privileges */ |
648
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
126 if (setgid (gid) || setuid (uid)) |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
127 { |
648
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
128 syslog_error_printf("Failed to drop privileges: %s", strerror(errno)); |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
129 exit(-1); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
130 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
131 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
132 close (pipe_fd[1]); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
133 dup2 (pipe_fd[0], 0); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
134 close (pipe_fd[0]); |
383
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
135 execve (argv[0], argv, envp); |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
136 exit (127); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
137 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
138 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
139 close (pipe_fd[0]); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
140 stream = fdopen(pipe_fd[1], "w"); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
141 if (stream == NULL) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
142 { |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
143 ERRORPRINTF ("Failed to open pipe for writing\n"); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
144 goto done; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
145 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
146 |
384
638db75f0fdf
Ignore sigpipe if the child closed the channel or there is an error
Andre Heinecke <andre.heinecke@intevation.de>
parents:
383
diff
changeset
|
147 /* The NSS installer may exit on error before we are done |
638db75f0fdf
Ignore sigpipe if the child closed the channel or there is an error
Andre Heinecke <andre.heinecke@intevation.de>
parents:
383
diff
changeset
|
148 * telling it what to do. We want to handle that rather |
638db75f0fdf
Ignore sigpipe if the child closed the channel or there is an error
Andre Heinecke <andre.heinecke@intevation.de>
parents:
383
diff
changeset
|
149 * then die unexpectedly. */ |
638db75f0fdf
Ignore sigpipe if the child closed the channel or there is an error
Andre Heinecke <andre.heinecke@intevation.de>
parents:
383
diff
changeset
|
150 signal(SIGPIPE, SIG_IGN); |
638db75f0fdf
Ignore sigpipe if the child closed the channel or there is an error
Andre Heinecke <andre.heinecke@intevation.de>
parents:
383
diff
changeset
|
151 |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
152 /* Send the instructions */ |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
153 for (i = 0; to_install && to_install[i]; i++) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
154 { |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
155 if (fprintf (stream, "I:%s\n", to_install[i]) <= 3) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
156 { |
478
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
157 int err = errno; |
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
158 ERRORPRINTF ("Write failed: %s \n", strerror(err)); |
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
159 if (err == 32) |
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
160 { |
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
161 /* Broken pipe is expected if there are no NSS stores |
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
162 to be found the process just exits. That's ok */ |
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
163 success = true; |
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
164 } |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
165 goto done; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
166 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
167 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
168 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
169 for (i = 0; to_remove && to_remove[i]; i++) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
170 { |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
171 if (fprintf (stream, "R:%s\n", to_remove[i]) <= 3) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
172 { |
478
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
173 int err = errno; |
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
174 ERRORPRINTF ("Write failed: %s \n", strerror(err)); |
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
175 if (err == 32) |
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
176 { |
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
177 /* Broken pipe is expected if there are no NSS stores |
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
178 to be found the process just exits. That's ok */ |
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
179 success = true; |
214bf504c54f
Handle broken pipe as it is expected behavior
Andre Heinecke <aheinecke@intevation.de>
parents:
476
diff
changeset
|
180 } |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
181 goto done; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
182 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
183 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
184 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
185 success = true; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
186 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
187 done: |
905
698b6a9bd75e
Fix coding style for C code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
841
diff
changeset
|
188 if (stream) |
698b6a9bd75e
Fix coding style for C code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
841
diff
changeset
|
189 { |
698b6a9bd75e
Fix coding style for C code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
841
diff
changeset
|
190 fclose (stream); |
698b6a9bd75e
Fix coding style for C code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
841
diff
changeset
|
191 } |
383
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
192 xfree (argv[0]); |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
193 xfree (envp[0]); |
383
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
194 close (pipe_fd[0]); |
5eb7ee4ee819
Look up executable name based on /proc/self/exe
Andre Heinecke <andre.heinecke@intevation.de>
parents:
321
diff
changeset
|
195 close (pipe_fd[1]); |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
196 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
197 if (success) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
198 { |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
199 return pid; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
200 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
201 return -1; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
202 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
203 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
204 int |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
205 write_stores_nss (char **to_install, char **to_remove) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
206 { |
648
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
207 struct passwd *usr_it = NULL; |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
208 uid_t my_uid = geteuid(); |
975
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
209 pid_t childprocess = -1; |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
210 int status = -1; |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
211 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
212 if (my_uid != 0) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
213 { |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
214 /* Running as a user */ |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
215 char *homedir = getenv ("HOME"); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
216 if (!homedir) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
217 { |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
218 ERRORPRINTF ("Failed to find home directory\n"); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
219 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
220 |
975
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
221 /* Only one child for single user installation */ |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
222 childprocess = start_procces_for_user (to_install, to_remove, |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
223 my_uid, getgid(), homedir); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
224 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
225 if (childprocess == -1) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
226 { |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
227 ERRORPRINTF ("Failed to start childprocess!\n"); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
228 return -1; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
229 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
230 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
231 childprocess = waitpid (childprocess, &status, 0); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
232 if (childprocess == -1 || !WIFEXITED(status)) |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
233 { |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
234 ERRORPRINTF ("Waitpid failed.\n"); |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
235 return -1; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
236 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
237 |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
238 return 0; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
239 } |
648
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
240 |
975
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
241 /* Start once as root to install in the system default directories. */ |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
242 childprocess = start_procces_for_user (to_install, to_remove, |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
243 my_uid, getgid(), getenv ("HOME")); |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
244 if (childprocess == -1) |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
245 { |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
246 ERRORPRINTF ("Failed to start default profile installation!\n"); |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
247 return -1; |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
248 } |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
249 |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
250 /* Wait until the default profile directories are done. */ |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
251 childprocess = waitpid (childprocess, &status, 0); |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
252 if (childprocess == -1 || !WIFEXITED(status)) |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
253 { |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
254 ERRORPRINTF ("Child process did not finish.\n"); |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
255 return -1; |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
256 } |
b3695a3399de
(issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
947
diff
changeset
|
257 |
648
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
258 setpwent(); |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
259 |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
260 while ((usr_it = getpwent ()) != NULL) |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
261 { |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
262 /* Skip obvious system accounts */ |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
263 if (strcmp(usr_it->pw_shell, "/usr/sbin/nologin") == 0 || |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
264 strcmp(usr_it->pw_shell, "/bin/false") == 0) |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
265 { |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
266 continue; |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
267 } |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
268 /* A check if the home directory starts with /home might be |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
269 appropiate */ |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
270 start_procces_for_user (to_install, |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
271 to_remove, |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
272 usr_it->pw_uid, |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
273 usr_it->pw_gid, |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
274 usr_it->pw_dir); |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
275 |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
276 } |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
277 |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
278 endpwent(); |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
279 |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
280 waitpid (-1, NULL, 0); |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
281 |
e41a2537b84d
Implement root installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
478
diff
changeset
|
282 DEBUGPRINTF ("NSS installation done\n"); |
302
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
283 return 0; |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
284 } |
fac7e1b0e558
Add nss store calling function and use it in cinst
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
285 #endif |