]> git.sur5r.net Git - ngadmin/blob - cli/com_password.c
f93412ef79ae82219b68c134757571b29ece58fb
[ngadmin] / cli / com_password.c
1
2 #include "commands.h"
3
4
5
6 bool do_password_change (int nb, const char **com, struct ngadmin *nga) {
7  
8  int i;
9  const struct swi_attr *sa;
10  
11  
12  if ( nb!=1 ) {
13   printf("Usage: password change <value>\n");
14   return false;
15  }
16  
17  if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) {
18   printf("must be logged\n");
19   return false;
20  }
21  
22  i=ngadmin_changePassword(nga, com[0]);
23  printErrCode(i);
24  
25  
26  return true;
27  
28 }
29
30
31
32 bool do_password_set (int nb, const char **com, struct ngadmin *nga) {
33  
34  int i;
35  
36  
37  if ( nb!=1 ) {
38   printf("Usage: password set <value>\n");
39   return false;
40  }
41  
42  i=ngadmin_setPassword(nga, com[0]);
43  printErrCode(i);
44  
45  
46  return true;
47  
48 }
49
50
51