|
1 // Copyright (C) 1999,2000 Bruce Guenter <bruceg@em.ca> |
|
2 // |
|
3 // This program is free software; you can redistribute it and/or modify |
|
4 // it under the terms of the GNU General Public License as published by |
|
5 // the Free Software Foundation; either version 2 of the License, or |
|
6 // (at your option) any later version. |
|
7 // |
|
8 // This program is distributed in the hope that it will be useful, |
|
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 // GNU General Public License for more details. |
|
12 // |
|
13 // You should have received a copy of the GNU General Public License |
|
14 // along with this program; if not, write to the Free Software |
|
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
16 |
|
17 #include <config.h> |
|
18 #include <pwd.h> |
|
19 #include <stdlib.h> |
|
20 #include <unistd.h> |
|
21 #include "config/configrc.h" |
|
22 #include "pwentry.h" |
|
23 |
|
24 pwentry::pwentry() |
|
25 : name(getenv("USER")), pass(), uid(getuid()), gid(getgid()), |
|
26 home(getenv("HOME")), config(::config, home + "/" LOCAL_CONFIG_DIR) |
|
27 { |
|
28 } |
|
29 |
|
30 pwentry::pwentry(const mystring& n, const mystring& p, |
|
31 uid_t u, gid_t g, const mystring& h) |
|
32 : name(n), pass(p), uid(u), gid(g), home(h), |
|
33 config(::config, home + "/" LOCAL_CONFIG_DIR) |
|
34 { |
|
35 } |
|
36 |
|
37 pwentry::pwentry(const struct passwd& pw) |
|
38 : name(pw.pw_name), pass(pw.pw_passwd), uid(pw.pw_uid), gid(pw.pw_gid), |
|
39 home(pw.pw_dir), config(::config, home + "/" LOCAL_CONFIG_DIR) |
|
40 { |
|
41 } |
|
42 |
|
43 pwentry::~pwentry() |
|
44 { |
|
45 } |
|
46 |
|
47 mystring pwentry::pwfile() |
|
48 { |
|
49 return home + "/" + config.password_file(); |
|
50 } |