5 #include <nsdp/protocol.h>
12 int ngadmin_setName (struct ngadmin *nga, const char *name)
28 attr = createEmptyList();
30 at = newEmptyAttr(ATTR_NAME);
32 at = newAttr(ATTR_NAME, strlen(name), strdup(name));
33 pushBackList(attr, at);
34 ret = writeRequest(nga, attr);
38 /* successful, also update local name */
40 memset(sa->name, '\0', NAME_SIZE);
42 strncpy(sa->name, name, NAME_SIZE);
49 int ngadmin_changePassword (struct ngadmin *nga, const char* pass)
56 if (nga == NULL || pass == NULL)
58 else if (nga->current == NULL)
62 attr = createEmptyList();
63 at = newAttr(ATTR_NEW_PASSWORD, strlen(pass), strdup(pass));
64 if (nga->encrypt_pass)
65 passwordEndecode(at->data, at->size);
66 pushBackList(attr, at);
67 ret = writeRequest(nga, attr);
71 /* successful, also update local password */
72 strncpy(nga->password, pass, PASSWORD_MAX);
80 int ngadmin_restart (struct ngadmin *nga)
85 attr = createEmptyList();
86 pushBackList(attr, newByteAttr(ATTR_RESTART, 1));
89 return writeRequest(nga, attr);
93 int ngadmin_defaults (struct ngadmin *nga)
99 attr = createEmptyList();
100 pushBackList(attr, newByteAttr(ATTR_DEFAULTS, 1));
101 ret = writeRequest(nga, attr);
106 /* successful: delog and clean list */