r13121: Tag 4.0.0TP1
[Samba.git] / source / nbt_server / wins / wins_hook.c
blob4c798fc18c3a060b286f9867a075fd33038d3088
1 /*
2 Unix SMB/CIFS implementation.
4 wins hook feature, we run a specified script
5 which can then do some custom actions
7 Copyright (C) Stefan Metzmacher 2005
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "includes.h"
25 #include "nbt_server/nbt_server.h"
26 #include "nbt_server/wins/winsdb.h"
28 static const char *wins_hook_action_string(enum wins_hook_action action)
30 switch (action) {
31 case WINS_HOOK_ADD: return "WINS_HOOK_ADD";
32 case WINS_HOOK_MODIFY: return "WINS_HOOK_MODIFY";
33 case WINS_HOOK_DELETE: return "WINS_HOOK_DELETE";
36 return "WINS_HOOK_ACTION_UNKNOWN";
39 void wins_hook(struct winsdb_handle *h, struct winsdb_record *rec, enum wins_hook_action action)
41 const char *script = lp_wins_hook();
42 if (!script || !script[0]) return;
44 DEBUG(0,("TODO: call wins hook '%s' '%s' for name '%s'\n",
45 script, wins_hook_action_string(action),
46 nbt_name_string(rec, rec->name)));