pidl: call local and remote calls only when servername is available
authorGünther Deschner <gd@samba.org>
Mon, 1 Mar 2021 14:28:04 +0000 (15:28 +0100)
committerGünther Deschner <gd@samba.org>
Fri, 22 Sep 2023 16:23:34 +0000 (18:23 +0200)
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
pidl/lib/Parse/Pidl/Samba3/libnetapi.pm

index f71d9808c27b3460f8937416aef38377d4ee081e..5887796b672d6e69d5052e26946dbf865d1303e2 100644 (file)
@@ -136,15 +136,19 @@ sub ParseFunction($$$)
                if (grep(/out/, @{$_->{DIRECTION}})) { $hasout = 1; }
        }
 
-       $self->pidl("if (LIBNETAPI_LOCAL_SERVER($fn->{ELEMENTS}[0]->{NAME})) {");
-       $self->indent;
-       $self->pidl("$fn_str_l(ctx, &r);");
-       $self->deindent;
-       $self->pidl("} else {");
-       $self->indent;
-       $self->pidl("$fn_str_r(ctx, &r);");
-       $self->deindent;
-       $self->pidl("}");
+       if ($fn->{ELEMENTS}[0]->{NAME} =~ /server/) {
+               $self->pidl("if (LIBNETAPI_LOCAL_SERVER($fn->{ELEMENTS}[0]->{NAME})) {");
+               $self->indent;
+               $self->pidl("$fn_str_l(ctx, &r);");
+               $self->deindent;
+               $self->pidl("} else {");
+               $self->indent;
+               $self->pidl("$fn_str_r(ctx, &r);");
+               $self->deindent;
+               $self->pidl("}");
+       } else {
+               $self->pidl("$fn_str_l(ctx, &r);");
+       }
        $self->pidl("");
        $self->pidl("r.out.result = W_ERROR_V(werr);");
        $self->pidl("");