}
trust_pw = get_pass(_("Enter machine password: "), c->opt_stdin);
+ if (trust_pw == NULL) {
+ d_fprintf(stderr,
+ _("Error in reading machine password\n"));
+ return 1;
+ }
if (!secrets_store_machine_password(trust_pw, lp_workgroup(), sec_channel_type)) {
d_fprintf(stderr,
* the newline that ends the password, then replace the newline with
* a null terminator.
*/
- if ( fgets(new_pw, sizeof(new_pw), stdin) != NULL) {
- if ((len = strlen(new_pw)) > 0) {
- if(new_pw[len-1] == '\n')
- new_pw[len - 1] = 0;
- }
+ if ( fgets(new_pw, sizeof(new_pw), stdin) == NULL) {
+ return NULL;
+ }
+ if ((len = strlen(new_pw)) > 0) {
+ if(new_pw[len-1] == '\n')
+ new_pw[len - 1] = 0;
}
return(new_pw);
}
if (stdin_get) {
p = stdin_new_passwd();
+ if (p == NULL) {
+ return NULL;
+ }
} else {
rc = samba_getpass(prompt, pwd, sizeof(pwd), false, false);
if (rc < 0) {
ZERO_ARRAY(new_pw);
p = get_pass("New SMB password:", stdin_get);
+ if (p == NULL) {
+ return NULL;
+ }
fstrcpy(new_pw, p);
SAFE_FREE(p);
p = get_pass("Retype new SMB password:", stdin_get);
+ if (p == NULL) {
+ return NULL;
+ }
if (strcmp(p, new_pw)) {
fprintf(stderr, "Mismatch - password unchanged.\n");
printf("Setting stored password for \"%s\" in secrets.tdb\n", ldap_admin_dn);
if ( ! *ldap_secret ) {
new_passwd = prompt_for_new_password(stdin_passwd_get);
+ if (new_passwd == NULL) {
+ fprintf(stderr, "Failed to read new password!\n");
+ exit(1);
+ }
fstrcpy(ldap_secret, new_passwd);
}
if (!store_ldap_admin_pw(ldap_secret)) {
if (remote_machine != NULL) {
old_pw = get_pass("Old SMB password:",stdin_passwd_get);
+ if (old_pw == NULL) {
+ fprintf(stderr, "Unable to get old password.\n");
+ exit(1);
+ }
}
if (!new_passwd) {