rpm  4.5
getpass.c
Go to the documentation of this file.
1 
5 #include "system.h"
6 #if HAVE_KEYUTILS_H
7 #include <argv.h>
8 #include <keyutils.h>
9 #endif
10 #include "debug.h"
11 
12 char * _GetPass(const char * prompt)
13 {
14 /*@-unrecog@*/
15  return getpass( prompt ? prompt : "" );
16 /*@=unrecog@*/
17 }
18 
19 char * _RequestPass(const char * prompt)
20 {
21  static char * password = NULL;
22 #if HAVE_KEYUTILS_H
23  const char * foo = "user rpm:yyyy spoon";
24  ARGV_t av = NULL;
25  int xx = argvSplit(&av, foo, NULL);
26  key_serial_t dest = 0;
27  key_serial_t key = 0;
28 
29  if (password) {
30  free(password);
31  password = NULL;
32  }
33  key = request_key(av[0], av[1], av[2], dest);
34 
35  xx = keyctl_read_alloc(key, (void *)&password);
36 #endif
37 
38  return password;
39 }
40 
41 char * (*Getpass) (const char * prompt) = _GetPass;