- if (r == 2)
- {
- auth = &au;
- au.which = Z_IdAuthentication_idPass;
- au.u.idPass = &idPass;
- idPass.groupId = NULL;
- idPass.userId = user;
- idPass.password = group;
- printf("Authentication set to User (%s), Pass (%s)\n", user, group);
+ else if (r == 2)
+ {
+ auth = (Z_IdAuthentication *) nmem_malloc(nmem_auth, sizeof(*auth));
+ auth->which = Z_IdAuthentication_idPass;
+ auth->u.idPass = (Z_IdPass *)
+ nmem_malloc(nmem_auth, sizeof(*auth->u.idPass));
+ auth->u.idPass->groupId = NULL;
+ auth->u.idPass->userId = !strcmp(args[0], "-") ? 0 : args[0];
+ auth->u.idPass->password = !strcmp(args[1], "-") ? 0 : args[1];
+ printf("Authentication set to User (%s), Pass (%s)\n",
+ args[0], args[1]);
+ }
+ else if (r == 3)
+ {
+ auth = (Z_IdAuthentication*) nmem_malloc(nmem_auth, sizeof(*auth));
+ auth->which = Z_IdAuthentication_idPass;
+ auth->u.idPass = (Z_IdPass *)
+ nmem_malloc(nmem_auth, sizeof(*auth->u.idPass));
+ auth->u.idPass->groupId = args[1];
+ auth->u.idPass->userId = args[0];
+ auth->u.idPass->password = args[2];
+ printf("Authentication set to User (%s), Group (%s), Pass (%s)\n",
+ args[0], args[1], args[2]);