lib: Add lib/util/server_id.h
[samba.git] / source3 / utils / status.c
1 /* 
2    Unix SMB/CIFS implementation.
3    status reporting
4    Copyright (C) Andrew Tridgell 1994-1998
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19    Revision History:
20
21    12 aug 96: Erik.Devriendt@te6.siemens.be
22    added support for shared memory implementation of share mode locking
23
24    21-Jul-1998: rsharpe@ns.aus.com (Richard Sharpe)
25    Added -L (locks only) -S (shares only) flags and code
26
27 */
28
29 /*
30  * This program reports current SMB connections
31  */
32
33 #include "includes.h"
34 #include "lib/util/server_id.h"
35 #include "smbd/globals.h"
36 #include "system/filesys.h"
37 #include "popt_common.h"
38 #include "dbwrap/dbwrap.h"
39 #include "dbwrap/dbwrap_open.h"
40 #include "../libcli/security/security.h"
41 #include "session.h"
42 #include "locking/proto.h"
43 #include "messages.h"
44 #include "librpc/gen_ndr/open_files.h"
45 #include "smbd/smbd.h"
46 #include "librpc/gen_ndr/notify.h"
47 #include "lib/conn_tdb.h"
48 #include "serverid.h"
49 #include "status_profile.h"
50 #include "smbd/notifyd/notifyd.h"
51
52 #define SMB_MAXPIDS             2048
53 static uid_t            Ucrit_uid = 0;               /* added by OH */
54 static struct server_id Ucrit_pid[SMB_MAXPIDS];  /* Ugly !!! */   /* added by OH */
55 static int              Ucrit_MaxPid=0;                    /* added by OH */
56 static unsigned int     Ucrit_IsActive = 0;                /* added by OH */
57
58 static bool verbose, brief;
59 static bool shares_only;            /* Added by RJS */
60 static bool locks_only;            /* Added by RJS */
61 static bool processes_only;
62 static bool show_brl;
63 static bool numeric_only;
64 static bool do_checks = true;
65
66 const char *username = NULL;
67
68 /* added by OH */
69 static void Ucrit_addUid(uid_t uid)
70 {
71         Ucrit_uid = uid;
72         Ucrit_IsActive = 1;
73 }
74
75 static unsigned int Ucrit_checkUid(uid_t uid)
76 {
77         if ( !Ucrit_IsActive ) 
78                 return 1;
79
80         if ( uid == Ucrit_uid ) 
81                 return 1;
82
83         return 0;
84 }
85
86 static unsigned int Ucrit_checkPid(struct server_id pid)
87 {
88         int i;
89
90         if ( !Ucrit_IsActive ) 
91                 return 1;
92
93         for (i=0;i<Ucrit_MaxPid;i++) {
94                 if (serverid_equal(&pid, &Ucrit_pid[i])) {
95                         return 1;
96                 }
97         }
98
99         return 0;
100 }
101
102 static bool Ucrit_addPid( struct server_id pid )
103 {
104         if ( !Ucrit_IsActive )
105                 return True;
106
107         if ( Ucrit_MaxPid >= SMB_MAXPIDS ) {
108                 d_printf("ERROR: More than %d pids for user %s!\n",
109                          SMB_MAXPIDS, uidtoname(Ucrit_uid));
110
111                 return False;
112         }
113
114         Ucrit_pid[Ucrit_MaxPid++] = pid;
115
116         return True;
117 }
118
119 static int print_share_mode(const struct share_mode_entry *e,
120                             const char *sharepath,
121                             const char *fname,
122                             const char *sname,
123                             void *dummy)
124 {
125         static int count;
126
127         if (do_checks && !is_valid_share_mode_entry(e)) {
128                 return 0;
129         }
130
131         if (count==0) {
132                 d_printf("Locked files:\n");
133                 d_printf("Pid          Uid        DenyMode   Access      R/W        Oplock           SharePath   Name   Time\n");
134                 d_printf("--------------------------------------------------------------------------------------------------\n");
135         }
136         count++;
137
138         if (do_checks && !serverid_exists(&e->pid)) {
139                 /* the process for this entry does not exist any more */
140                 return 0;
141         }
142
143         if (Ucrit_checkPid(e->pid)) {
144                 struct server_id_buf tmp;
145                 d_printf("%-11s  ", server_id_str_buf(e->pid, &tmp));
146                 d_printf("%-9u  ", (unsigned int)e->uid);
147                 switch (map_share_mode_to_deny_mode(e->share_access,
148                                                     e->private_options)) {
149                         case DENY_NONE: d_printf("DENY_NONE  "); break;
150                         case DENY_ALL:  d_printf("DENY_ALL   "); break;
151                         case DENY_DOS:  d_printf("DENY_DOS   "); break;
152                         case DENY_READ: d_printf("DENY_READ  "); break;
153                         case DENY_WRITE:printf("DENY_WRITE "); break;
154                         case DENY_FCB:  d_printf("DENY_FCB "); break;
155                         default: {
156                                 d_printf("unknown-please report ! "
157                                          "e->share_access = 0x%x, "
158                                          "e->private_options = 0x%x\n",
159                                          (unsigned int)e->share_access,
160                                          (unsigned int)e->private_options );
161                                 break;
162                         }
163                 }
164                 d_printf("0x%-8x  ",(unsigned int)e->access_mask);
165                 if ((e->access_mask & (FILE_READ_DATA|FILE_WRITE_DATA))==
166                                 (FILE_READ_DATA|FILE_WRITE_DATA)) {
167                         d_printf("RDWR       ");
168                 } else if (e->access_mask & FILE_WRITE_DATA) {
169                         d_printf("WRONLY     ");
170                 } else {
171                         d_printf("RDONLY     ");
172                 }
173
174                 if((e->op_type & (EXCLUSIVE_OPLOCK|BATCH_OPLOCK)) == 
175                                         (EXCLUSIVE_OPLOCK|BATCH_OPLOCK)) {
176                         d_printf("EXCLUSIVE+BATCH ");
177                 } else if (e->op_type & EXCLUSIVE_OPLOCK) {
178                         d_printf("EXCLUSIVE       ");
179                 } else if (e->op_type & BATCH_OPLOCK) {
180                         d_printf("BATCH           ");
181                 } else if (e->op_type & LEVEL_II_OPLOCK) {
182                         d_printf("LEVEL_II        ");
183                 } else if (e->op_type == LEASE_OPLOCK) {
184                         uint32_t lstate = e->lease->current_state;
185                         d_printf("LEASE(%s%s%s)%s%s%s      ",
186                                  (lstate & SMB2_LEASE_READ)?"R":"",
187                                  (lstate & SMB2_LEASE_WRITE)?"W":"",
188                                  (lstate & SMB2_LEASE_HANDLE)?"H":"",
189                                  (lstate & SMB2_LEASE_READ)?"":" ",
190                                  (lstate & SMB2_LEASE_WRITE)?"":" ",
191                                  (lstate & SMB2_LEASE_HANDLE)?"":" ");
192                 } else {
193                         d_printf("NONE            ");
194                 }
195
196                 d_printf(" %s   %s%s   %s",
197                          sharepath, fname,
198                          sname ? sname : "",
199                          time_to_asc((time_t)e->time.tv_sec));
200         }
201
202         return 0;
203 }
204
205 static void print_brl(struct file_id id,
206                         struct server_id pid, 
207                         enum brl_type lock_type,
208                         enum brl_flavour lock_flav,
209                         br_off start,
210                         br_off size,
211                         void *private_data)
212 {
213         static int count;
214         unsigned int i;
215         static const struct {
216                 enum brl_type lock_type;
217                 const char *desc;
218         } lock_types[] = {
219                 { READ_LOCK, "R" },
220                 { WRITE_LOCK, "W" },
221                 { PENDING_READ_LOCK, "PR" },
222                 { PENDING_WRITE_LOCK, "PW" },
223                 { UNLOCK_LOCK, "U" }
224         };
225         const char *desc="X";
226         const char *sharepath = "";
227         char *fname = NULL;
228         struct share_mode_lock *share_mode;
229         struct server_id_buf tmp;
230
231         if (count==0) {
232                 d_printf("Byte range locks:\n");
233                 d_printf("Pid        dev:inode       R/W  start     size      SharePath               Name\n");
234                 d_printf("--------------------------------------------------------------------------------\n");
235         }
236         count++;
237
238         share_mode = fetch_share_mode_unlocked(NULL, id);
239         if (share_mode) {
240                 bool has_stream = share_mode->data->stream_name != NULL;
241
242                 fname = talloc_asprintf(NULL, "%s%s%s",
243                                         share_mode->data->base_name,
244                                         has_stream ? ":" : "",
245                                         has_stream ?
246                                         share_mode->data->stream_name :
247                                         "");
248         } else {
249                 fname = talloc_strdup(NULL, "");
250                 if (fname == NULL) {
251                         return;
252                 }
253         }
254
255         for (i=0;i<ARRAY_SIZE(lock_types);i++) {
256                 if (lock_type == lock_types[i].lock_type) {
257                         desc = lock_types[i].desc;
258                 }
259         }
260
261         d_printf("%-10s %-15s %-4s %-9jd %-9jd %-24s %-24s\n",
262                  server_id_str_buf(pid, &tmp), file_id_string_tos(&id),
263                  desc,
264                  (intmax_t)start, (intmax_t)size,
265                  sharepath, fname);
266
267         TALLOC_FREE(fname);
268         TALLOC_FREE(share_mode);
269 }
270
271 static const char *session_dialect_str(uint16_t dialect)
272 {
273         static fstring unkown_dialect;
274
275         switch(dialect){
276         case SMB2_DIALECT_REVISION_000:
277                 return "NT1";
278         case SMB2_DIALECT_REVISION_202:
279                 return "SMB2_02";
280         case SMB2_DIALECT_REVISION_210:
281                 return "SMB2_10";
282         case SMB2_DIALECT_REVISION_222:
283                 return "SMB2_22";
284         case SMB2_DIALECT_REVISION_224:
285                 return "SMB2_24";
286         case SMB3_DIALECT_REVISION_300:
287                 return "SMB3_00";
288         case SMB3_DIALECT_REVISION_302:
289                 return "SMB3_02";
290         case SMB3_DIALECT_REVISION_310:
291                 return "SMB3_10";
292         case SMB3_DIALECT_REVISION_311:
293                 return "SMB3_11";
294         }
295
296         fstr_sprintf(unkown_dialect, "Unknown (0x%04x)", dialect);
297         return unkown_dialect;
298 }
299
300 static int traverse_connections(const struct connections_key *key,
301                                 const struct connections_data *crec,
302                                 void *private_data)
303 {
304         TALLOC_CTX *mem_ctx = (TALLOC_CTX *)private_data;
305         struct server_id_buf tmp;
306         char *timestr = NULL;
307         int result = 0;
308         const char *encryption = "-";
309         const char *signing = "-";
310
311         if (crec->cnum == TID_FIELD_INVALID)
312                 return 0;
313
314         if (do_checks &&
315             (!process_exists(crec->pid) || !Ucrit_checkUid(crec->uid))) {
316                 return 0;
317         }
318
319         timestr = timestring(mem_ctx, crec->start);
320         if (timestr == NULL) {
321                 return -1;
322         }
323
324         if (smbXsrv_is_encrypted(crec->encryption_flags)) {
325                 switch (crec->cipher) {
326                 case SMB_ENCRYPTION_GSSAPI:
327                         encryption = "GSSAPI";
328                         break;
329                 case SMB2_ENCRYPTION_AES128_CCM:
330                         encryption = "AES-128-CCM";
331                         break;
332                 case SMB2_ENCRYPTION_AES128_GCM:
333                         encryption = "AES-128-GCM";
334                         break;
335                 default:
336                         encryption = "???";
337                         result = -1;
338                         break;
339                 }
340         }
341
342         if (smbXsrv_is_signed(crec->signing_flags)) {
343                 if (crec->dialect >= SMB3_DIALECT_REVISION_302) {
344                         signing = "AES-128-CMAC";
345                 } else if (crec->dialect >= SMB2_DIALECT_REVISION_202) {
346                         signing = "HMAC-SHA256";
347                 } else {
348                         signing = "HMAC-MD5";
349                 }
350         }
351
352         d_printf("%-12s %-7s %-13s %-32s %-12s %-12s\n",
353                  crec->servicename, server_id_str_buf(crec->pid, &tmp),
354                  crec->machine,
355                  timestr,
356                  encryption,
357                  signing);
358
359         TALLOC_FREE(timestr);
360
361         return result;
362 }
363
364 static int traverse_sessionid(const char *key, struct sessionid *session,
365                               void *private_data)
366 {
367         TALLOC_CTX *mem_ctx = (TALLOC_CTX *)private_data;
368         fstring uid_str, gid_str;
369         struct server_id_buf tmp;
370         char *machine_hostname = NULL;
371         int result = 0;
372         const char *encryption = "-";
373         const char *signing = "-";
374
375         if (do_checks &&
376             (!process_exists(session->pid) ||
377              !Ucrit_checkUid(session->uid))) {
378                 return 0;
379         }
380
381         Ucrit_addPid(session->pid);
382
383         fstrcpy(uid_str, "-1");
384
385         if (session->uid != -1) {
386                 if (numeric_only) {
387                         fstr_sprintf(uid_str, "%u", (unsigned int)session->uid);
388                 } else {
389                         fstrcpy(uid_str, uidtoname(session->uid));
390                 }
391         }
392
393         fstrcpy(gid_str, "-1");
394
395         if (session->gid != -1) {
396                 if (numeric_only) {
397                         fstr_sprintf(gid_str, "%u", (unsigned int)session->gid);
398                 } else {
399                         fstrcpy(gid_str, gidtoname(session->gid));
400                 }
401         }
402
403         machine_hostname = talloc_asprintf(mem_ctx, "%s (%s)",
404                                            session->remote_machine,
405                                            session->hostname);
406         if (machine_hostname == NULL) {
407                 return -1;
408         }
409
410         if (smbXsrv_is_encrypted(session->encryption_flags)) {
411                 switch (session->cipher) {
412                 case SMB2_ENCRYPTION_AES128_CCM:
413                         encryption = "AES-128-CCM";
414                         break;
415                 case SMB2_ENCRYPTION_AES128_GCM:
416                         encryption = "AES-128-GCM";
417                         break;
418                 default:
419                         encryption = "???";
420                         result = -1;
421                         break;
422                 }
423         } else if (smbXsrv_is_partially_encrypted(session->encryption_flags)) {
424                 switch (session->cipher) {
425                 case SMB_ENCRYPTION_GSSAPI:
426                         encryption = "partial(GSSAPI)";
427                         break;
428                 case SMB2_ENCRYPTION_AES128_CCM:
429                         encryption = "partial(AES-128-CCM)";
430                         break;
431                 case SMB2_ENCRYPTION_AES128_GCM:
432                         encryption = "partial(AES-128-GCM)";
433                         break;
434                 default:
435                         encryption = "???";
436                         result = -1;
437                         break;
438                 }
439         }
440
441         if (smbXsrv_is_signed(session->signing_flags)) {
442                 if (session->connection_dialect >= SMB3_DIALECT_REVISION_302) {
443                         signing = "AES-128-CMAC";
444                 } else if (session->connection_dialect >= SMB2_DIALECT_REVISION_202) {
445                         signing = "HMAC-SHA256";
446                 } else {
447                         signing = "HMAC-MD5";
448                 }
449         } else if (smbXsrv_is_partially_signed(session->signing_flags)) {
450                 if (session->connection_dialect >= SMB3_DIALECT_REVISION_302) {
451                         signing = "partial(AES-128-CMAC)";
452                 } else if (session->connection_dialect >= SMB2_DIALECT_REVISION_202) {
453                         signing = "partial(HMAC-SHA256)";
454                 } else {
455                         signing = "partial(HMAC-MD5)";
456                 }
457         }
458
459
460         d_printf("%-7s %-12s %-12s %-41s %-17s %-20s %-21s\n",
461                  server_id_str_buf(session->pid, &tmp),
462                  uid_str, gid_str,
463                  machine_hostname,
464                  session_dialect_str(session->connection_dialect),
465                  encryption,
466                  signing);
467
468         TALLOC_FREE(machine_hostname);
469
470         return result;
471 }
472
473
474 static bool print_notify_rec(const char *path, struct server_id server,
475                              const struct notify_instance *instance,
476                              void *private_data)
477 {
478         struct server_id_buf idbuf;
479
480         d_printf("%s\\%s\\%x\\%x\n", path, server_id_str_buf(server, &idbuf),
481                  (unsigned)instance->filter,
482                  (unsigned)instance->subdir_filter);
483
484         return true;
485 }
486
487 int main(int argc, const char *argv[])
488 {
489         int c;
490         int profile_only = 0;
491         bool show_processes, show_locks, show_shares;
492         bool show_notify = false;
493         poptContext pc;
494         struct poptOption long_options[] = {
495                 POPT_AUTOHELP
496                 {"processes",   'p', POPT_ARG_NONE,     NULL, 'p', "Show processes only" },
497                 {"verbose",     'v', POPT_ARG_NONE,     NULL, 'v', "Be verbose" },
498                 {"locks",       'L', POPT_ARG_NONE,     NULL, 'L', "Show locks only" },
499                 {"shares",      'S', POPT_ARG_NONE,     NULL, 'S', "Show shares only" },
500                 {"notify",      'N', POPT_ARG_NONE,     NULL, 'N', "Show notifies" },
501                 {"user",        'u', POPT_ARG_STRING,   &username, 'u', "Switch to user" },
502                 {"brief",       'b', POPT_ARG_NONE,     NULL, 'b', "Be brief" },
503                 {"profile",     'P', POPT_ARG_NONE, NULL, 'P', "Do profiling" },
504                 {"profile-rates", 'R', POPT_ARG_NONE, NULL, 'R', "Show call rates" },
505                 {"byterange",   'B', POPT_ARG_NONE,     NULL, 'B', "Include byte range locks"},
506                 {"numeric",     'n', POPT_ARG_NONE,     NULL, 'n', "Numeric uid/gid"},
507                 {"fast",        'f', POPT_ARG_NONE,     NULL, 'f', "Skip checks if processes still exist"},
508                 POPT_COMMON_SAMBA
509                 POPT_TABLEEND
510         };
511         TALLOC_CTX *frame = talloc_stackframe();
512         int ret = 0;
513         struct messaging_context *msg_ctx = NULL;
514         char *db_path;
515         bool ok;
516
517         sec_init();
518         smb_init_locale();
519
520         setup_logging(argv[0], DEBUG_STDERR);
521         lp_set_cmdline("log level", "0");
522
523         if (getuid() != geteuid()) {
524                 d_printf("smbstatus should not be run setuid\n");
525                 ret = 1;
526                 goto done;
527         }
528
529         if (getuid() != 0) {
530                 d_printf("smbstatus only works as root!\n");
531                 ret = 1;
532                 goto done;
533         }
534
535
536         pc = poptGetContext(NULL, argc, argv, long_options,
537                             POPT_CONTEXT_KEEP_FIRST);
538
539         while ((c = poptGetNextOpt(pc)) != -1) {
540                 switch (c) {
541                 case 'p':
542                         processes_only = true;
543                         break;
544                 case 'v':
545                         verbose = true;
546                         break;
547                 case 'L':
548                         locks_only = true;
549                         break;
550                 case 'S':
551                         shares_only = true;
552                         break;
553                 case 'N':
554                         show_notify = true;
555                         break;
556                 case 'b':
557                         brief = true;
558                         break;
559                 case 'u':
560                         Ucrit_addUid(nametouid(poptGetOptArg(pc)));
561                         break;
562                 case 'P':
563                 case 'R':
564                         profile_only = c;
565                         break;
566                 case 'B':
567                         show_brl = true;
568                         break;
569                 case 'n':
570                         numeric_only = true;
571                         break;
572                 case 'f':
573                         do_checks = false;
574                         break;
575                 }
576         }
577
578         /* setup the flags based on the possible combincations */
579
580         show_processes = !(shares_only || locks_only || profile_only) || processes_only;
581         show_locks     = !(shares_only || processes_only || profile_only) || locks_only;
582         show_shares    = !(processes_only || locks_only || profile_only) || shares_only;
583
584         if ( username )
585                 Ucrit_addUid( nametouid(username) );
586
587         if (verbose) {
588                 d_printf("using configfile = %s\n", get_dyn_CONFIGFILE());
589         }
590
591         if (!lp_load_initial_only(get_dyn_CONFIGFILE())) {
592                 fprintf(stderr, "Can't load %s - run testparm to debug it\n",
593                         get_dyn_CONFIGFILE());
594                 ret = -1;
595                 goto done;
596         }
597
598
599         /*
600          * This implicitly initializes the global ctdbd connection,
601          * usable by the db_open() calls further down.
602          */
603         msg_ctx = messaging_init(NULL, samba_tevent_context_init(NULL));
604         if (msg_ctx == NULL) {
605                 fprintf(stderr, "messaging_init failed\n");
606                 ret = -1;
607                 goto done;
608         }
609
610         if (!lp_load_global(get_dyn_CONFIGFILE())) {
611                 fprintf(stderr, "Can't load %s - run testparm to debug it\n",
612                         get_dyn_CONFIGFILE());
613                 ret = -1;
614                 goto done;
615         }
616
617         switch (profile_only) {
618                 case 'P':
619                         /* Dump profile data */
620                         ok = status_profile_dump(verbose);
621                         return ok ? 0 : 1;
622                 case 'R':
623                         /* Continuously display rate-converted data */
624                         ok = status_profile_rates(verbose);
625                         return ok ? 0 : 1;
626                 default:
627                         break;
628         }
629
630         if ( show_processes ) {
631                 d_printf("\nSamba version %s\n",samba_version_string());
632                 d_printf("%-7s %-12s %-12s %-41s %-17s %-20s %-21s\n", "PID", "Username", "Group", "Machine", "Protocol Version", "Encryption", "Signing");
633                 d_printf("----------------------------------------------------------------------------------------------------------------------------------------\n");
634
635                 sessionid_traverse_read(traverse_sessionid, frame);
636
637                 if (processes_only) {
638                         goto done;
639                 }
640         }
641
642         if ( show_shares ) {
643                 if (brief) {
644                         goto done;
645                 }
646
647                 d_printf("\n%-12s %-7s %-13s %-32s %-12s %-12s\n", "Service", "pid", "Machine", "Connected at", "Encryption", "Signing");
648                 d_printf("---------------------------------------------------------------------------------------------\n");
649
650                 connections_forall_read(traverse_connections, frame);
651
652                 d_printf("\n");
653
654                 if ( shares_only ) {
655                         goto done;
656                 }
657         }
658
659         if ( show_locks ) {
660                 int result;
661                 struct db_context *db;
662
663                 db_path = lock_path("locking.tdb");
664                 if (db_path == NULL) {
665                         d_printf("Out of memory - exiting\n");
666                         ret = -1;
667                         goto done;
668                 }
669
670                 db = db_open(NULL, db_path, 0,
671                              TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDONLY, 0,
672                              DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
673
674                 if (!db) {
675                         d_printf("%s not initialised\n", db_path);
676                         d_printf("This is normal if an SMB client has never "
677                                  "connected to your server.\n");
678                         TALLOC_FREE(db_path);
679                         exit(0);
680                 } else {
681                         TALLOC_FREE(db);
682                         TALLOC_FREE(db_path);
683                 }
684
685                 if (!locking_init_readonly()) {
686                         d_printf("Can't initialise locking module - exiting\n");
687                         ret = 1;
688                         goto done;
689                 }
690
691                 result = share_entry_forall(print_share_mode, NULL);
692
693                 if (result == 0) {
694                         d_printf("No locked files\n");
695                 } else if (result < 0) {
696                         d_printf("locked file list truncated\n");
697                 }
698
699                 d_printf("\n");
700
701                 if (show_brl) {
702                         brl_forall(print_brl, NULL);
703                 }
704
705                 locking_end();
706         }
707
708         if (show_notify) {
709                 struct notify_context *n;
710
711                 n = notify_init(talloc_tos(), msg_ctx,
712                                 messaging_tevent_context(msg_ctx),
713                                 NULL, NULL);
714                 if (n == NULL) {
715                         goto done;
716                 }
717                 notify_walk(n, print_notify_rec, NULL);
718                 TALLOC_FREE(n);
719         }
720
721 done:
722         TALLOC_FREE(frame);
723         return ret;
724 }