Пример #1
0
char *secrets_fetch_machine_password(const char *domain,
				     time_t *pass_last_set_time,
				     enum netr_SchannelType *channel)
{
	char *ret;
	ret = (char *)secrets_fetch(machine_password_keystr(domain), NULL);

	if (pass_last_set_time) {
		size_t size;
		uint32 *last_set_time;
		last_set_time = (unsigned int *)secrets_fetch(machine_last_change_time_keystr(domain), &size);
		if (last_set_time) {
			*pass_last_set_time = IVAL(last_set_time,0);
			SAFE_FREE(last_set_time);
		} else {
			*pass_last_set_time = 0;
		}
	}

	if (channel) {
		size_t size;
		uint32 *channel_type;
		channel_type = (unsigned int *)secrets_fetch(machine_sec_channel_type_keystr(domain), &size);
		if (channel_type) {
			*channel = IVAL(channel_type,0);
			SAFE_FREE(channel_type);
		} else {
			*channel = get_default_sec_channel();
		}
	}

	return ret;
}
Пример #2
0
bool secrets_delete_machine_password(const char *domain)
{
	if (!secrets_delete_prev_machine_password(domain)) {
		return false;
	}
	return secrets_delete(machine_password_keystr(domain));
}
Пример #3
0
bool secrets_delete_machine_password_ex(const char *domain)
{
	if (!secrets_delete(machine_password_keystr(domain))) {
		return false;
	}
	if (!secrets_delete(machine_sec_channel_type_keystr(domain))) {
		return false;
	}
	return secrets_delete(machine_last_change_time_keystr(domain));
}
Пример #4
0
static bool secrets_store_prev_machine_password(const char *domain)
{
	char *oldpass;
	bool ret;

	oldpass = (char *)secrets_fetch(machine_password_keystr(domain), NULL);
	if (oldpass == NULL) {
		return true;
	}
	ret = secrets_store(machine_prev_password_keystr(domain), oldpass, strlen(oldpass)+1);
	SAFE_FREE(oldpass);
	return ret;
}
Пример #5
0
bool secrets_store_machine_password(const char *pass, const char *domain, uint32 sec_channel)
{
	bool ret;
	uint32 last_change_time;
	uint32 sec_channel_type;

	ret = secrets_store(machine_password_keystr(domain), pass, strlen(pass)+1);
	if (!ret)
		return ret;

	SIVAL(&last_change_time, 0, time(NULL));
	ret = secrets_store(machine_last_change_time_keystr(domain), &last_change_time, sizeof(last_change_time));

	SIVAL(&sec_channel_type, 0, sec_channel);
	ret = secrets_store(machine_sec_channel_type_keystr(domain), &sec_channel_type, sizeof(sec_channel_type));

	return ret;
}
Пример #6
0
bool secrets_delete_machine_password(const char *domain)
{
	return secrets_delete(machine_password_keystr(domain));
}