*** samba-1.9.18p1/source/smbpasswd.c Mon Jan 26 15:05:46 1998 --- samba-1.9.18p1-patched/source/smbpasswd.c Fri Feb 6 18:02:09 1998 *************** *** 229,235 **** int lockfd = -1; char *pfile = SMB_PASSWD_FILE; char readbuf[16 * 1024]; ! TimeInit(); setup_logging(argv[0],True); --- 229,235 ---- int lockfd = -1; char *pfile = SMB_PASSWD_FILE; char readbuf[16 * 1024]; ! char pipe_passwd[100]; /* Buffer for -pipe option */ TimeInit(); setup_logging(argv[0],True); *************** *** 262,287 **** if (real_uid == 0 && (argc > 1)) { ! /* We are root - check if we should add the user */ ! if ((argv[1][0] == '-') && (argv[1][1] == 'a')) ! add_user = True; ! ! if(add_user && (argc <= 2 || argc > 4)) ! usage(argv[0]); ! /* root can specify password on command-line */ ! if (argc == (add_user ? 4 : 3)) ! { ! /* -a argument (add_user): new password is 3rd argument. */ ! /* no -a argument (add_user): new password is 2nd argument */ ! ! add_pass = add_user ? 3 : 2; ! } ! ! /* If we are root we can change another's password. */ ! strncpy(user_name, add_user ? argv[2] : argv[1], sizeof(user_name) - 1); user_name[sizeof(user_name) - 1] = '\0'; - pwd = getpwnam(user_name); } else --- 262,305 ---- if (real_uid == 0 && (argc > 1)) { ! /* We are root - check special options */ ! int i; ! BOOL pipe_mode = False; ! for (i=1; i= 0 && pipe_passwd[last] == '\n') pipe_passwd[last] = '\0'; ! /* Kludge */ ! argv[1] = pipe_passwd; ! add_pass = 1; ! } ! }else{ ! if (argc - i == 2){ ! add_pass = argc - 1; ! }else if (argc - i != 1){ ! usage (argv[0]); ! } ! } ! strncpy(user_name, argv[i], sizeof(user_name) - 1); user_name[sizeof(user_name) - 1] = '\0'; pwd = getpwnam(user_name); } else