示例#1
0
static BOOL hash_check_notify(connection_struct *conn, uint16 vuid, char *path, uint32 flags, void *datap, time_t t)
{
	struct change_data *data = (struct change_data *)datap;
	struct change_data data2;

	if (t && t < data->last_check_time + lp_change_notify_timeout())
		return False;

	if (!change_to_user(conn,vuid))
		return True;
	if (!set_current_service(conn,True)) {
		change_to_root_user();
		return True;
	}

	if (!notify_hash(conn, path, flags, &data2, data) ||
	    data2.modify_time != data->modify_time ||
	    data2.status_time != data->status_time ||
	    data2.total_time != data->total_time ||
	    data2.num_entries != data->num_entries ||
		data2.mode_sum != data->mode_sum ||
		memcmp(data2.name_hash, data->name_hash, sizeof(data2.name_hash))) {
		change_to_root_user();
		return True;
	}

	if (t)
		data->last_check_time = t;

	change_to_root_user();

	return False;
}
示例#2
0
struct cnotify_fns *hash_notify_init(void) 
{
	static struct cnotify_fns cnotify;

	cnotify.register_notify = hash_register_notify;
	cnotify.check_notify = hash_check_notify;
	cnotify.remove_notify = hash_remove_notify;
	cnotify.select_time = lp_change_notify_timeout();

	return &cnotify;
}