Print info from sam structure
**********************************************************/
-static int print_sam_info (struct samu *sam_pwent, BOOL verbosity, BOOL smbpwdstyle)
+static int print_sam_info (struct samu *sam_pwent, bool verbosity, bool smbpwdstyle)
{
uid_t uid;
time_t tmp;
/* TODO: chaeck if entry is a user or a workstation */
if (!sam_pwent) return -1;
-
+
if (verbosity) {
- pstring temp;
+ char temp[44];
const uint8 *hours;
-
+
printf ("Unix username: %s\n", pdb_get_username(sam_pwent));
printf ("NT username: %s\n", pdb_get_nt_username(sam_pwent));
printf ("Account Flags: %s\n", pdb_encode_acct_ctrl(pdb_get_acct_ctrl(sam_pwent), NEW_PW_FORMAT_SPACE_PADDED_LEN));
printf ("Account desc: %s\n", pdb_get_acct_desc(sam_pwent));
printf ("Workstations: %s\n", pdb_get_workstations(sam_pwent));
printf ("Munged dial: %s\n", pdb_get_munged_dial(sam_pwent));
-
+
tmp = pdb_get_logon_time(sam_pwent);
printf ("Logon time: %s\n", tmp ? http_timestring(tmp) : "0");
-
+
tmp = pdb_get_logoff_time(sam_pwent);
printf ("Logoff time: %s\n", tmp ? http_timestring(tmp) : "0");
-
+
tmp = pdb_get_kickoff_time(sam_pwent);
printf ("Kickoff time: %s\n", tmp ? http_timestring(tmp) : "0");
-
+
tmp = pdb_get_pass_last_set_time(sam_pwent);
printf ("Password last set: %s\n", tmp ? http_timestring(tmp) : "0");
-
+
tmp = pdb_get_pass_can_change_time(sam_pwent);
printf ("Password can change: %s\n", tmp ? http_timestring(tmp) : "0");
-
+
tmp = pdb_get_pass_must_change_time(sam_pwent);
printf ("Password must change: %s\n", tmp ? http_timestring(tmp) : "0");
tmp = pdb_get_bad_password_time(sam_pwent);
printf ("Last bad password : %s\n", tmp ? http_timestring(tmp) : "0");
- printf ("Bad password count : %d\n",
+ printf ("Bad password count : %d\n",
pdb_get_bad_password_count(sam_pwent));
-
+
hours = pdb_get_hours(sam_pwent);
pdb_sethexhours(temp, hours);
printf ("Logon hours : %s\n", temp);
-
+
} else if (smbpwdstyle) {
char lm_passwd[33];
char nt_passwd[33];
uid = nametouid(pdb_get_username(sam_pwent));
pdb_sethexpwd(lm_passwd, pdb_get_lanman_passwd(sam_pwent), pdb_get_acct_ctrl(sam_pwent));
pdb_sethexpwd(nt_passwd, pdb_get_nt_passwd(sam_pwent), pdb_get_acct_ctrl(sam_pwent));
-
+
printf("%s:%lu:%s:%s:%s:LCT-%08X:\n",
pdb_get_username(sam_pwent),
(unsigned long)uid,
Get an Print User Info
**********************************************************/
-static int print_user_info (struct pdb_methods *in, const char *username, BOOL verbosity, BOOL smbpwdstyle)
+static int print_user_info (struct pdb_methods *in, const char *username, bool verbosity, bool smbpwdstyle)
{
struct samu *sam_pwent=NULL;
- BOOL ret;
+ bool ret;
if ( (sam_pwent = samu_new( NULL )) == NULL ) {
return -1;
/*********************************************************
List Users
**********************************************************/
-static int print_users_list (struct pdb_methods *in, BOOL verbosity, BOOL smbpwdstyle)
+static int print_users_list (struct pdb_methods *in, bool verbosity, bool smbpwdstyle)
{
struct samu *sam_pwent=NULL;
- BOOL check;
+ bool check;
check = NT_STATUS_IS_OK(in->setsampwent(in, False, 0));
if (!check) {
static int fix_users_list (struct pdb_methods *in)
{
struct samu *sam_pwent=NULL;
- BOOL check;
+ bool check;
check = NT_STATUS_IS_OK(in->setsampwent(in, False, 0));
if (!check) {
const char *drive, const char *script,
const char *profile, const char *account_control,
const char *user_sid, const char *user_domain,
- const BOOL badpw, const BOOL hours)
+ const bool badpw, const bool hours)
{
- BOOL updated_autolock = False, updated_badpw = False;
+ bool updated_autolock = False, updated_badpw = False;
struct samu *sam_pwent=NULL;
- BOOL ret;
+ bool ret;
if ( (sam_pwent = samu_new( NULL )) == NULL ) {
return 1;
static int new_user (struct pdb_methods *in, const char *username,
const char *fullname, const char *homedir,
const char *drive, const char *script,
- const char *profile, char *user_sid, BOOL stdin_get)
+ const char *profile, char *user_sid, bool stdin_get)
{
struct samu *sam_pwent;
char *password1, *password2;
int main (int argc, char **argv)
{
- static BOOL list_users = False;
- static BOOL verbose = False;
- static BOOL spstyle = False;
- static BOOL machine = False;
- static BOOL add_user = False;
- static BOOL delete_user = False;
- static BOOL modify_user = False;
+ static int list_users = False;
+ static int verbose = False;
+ static int spstyle = False;
+ static int machine = False;
+ static int add_user = False;
+ static int delete_user = False;
+ static int modify_user = False;
uint32 setparms, checkparms;
int opt;
static char *full_name = NULL;
static char *backend = NULL;
static char *backend_in = NULL;
static char *backend_out = NULL;
- static BOOL transfer_groups = False;
- static BOOL transfer_account_policies = False;
- static BOOL reset_account_policies = False;
- static BOOL force_initialised_password = False;
+ static int transfer_groups = False;
+ static int transfer_account_policies = False;
+ static int reset_account_policies = False;
+ static int force_initialised_password = False;
static char *logon_script = NULL;
static char *profile_path = NULL;
static char *user_domain = NULL;
static char *account_policy = NULL;
static char *user_sid = NULL;
static long int account_policy_value = 0;
- BOOL account_policy_value_set = False;
- static BOOL badpw_reset = False;
- static BOOL hours_reset = False;
+ bool account_policy_value_set = False;
+ static int badpw_reset = False;
+ static int hours_reset = False;
static char *pwd_time_format = NULL;
- static BOOL pw_from_stdin = False;
+ static int pw_from_stdin = False;
struct pdb_methods *bin, *bout, *bdef;
char *configfile = NULL;
TALLOC_CTX *frame = talloc_stackframe();
if (user_name == NULL)
user_name = poptGetArg(pc);
- if (!lp_load(configfile?configfile:dyn_CONFIGFILE,
- True,False,False,True)) {
- fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);
+ if (!lp_load(get_dyn_CONFIGFILE(),True,False,False,True)) {
+ fprintf(stderr, "Can't load %s - run testparm to debug it\n", get_dyn_CONFIGFILE());
exit(1);
}