| 1 | --- a/source3/rpc_server/rpc_handles.c |
| 2 | +++ b/source3/rpc_server/rpc_handles.c |
| 3 | @@ -59,8 +59,11 @@ struct handle_list { |
| 4 | |
| 5 | static bool is_samr_lsa_pipe(const struct ndr_syntax_id *syntax) |
| 6 | { |
| 7 | - return (ndr_syntax_id_equal(syntax, &ndr_table_samr.syntax_id) |
| 8 | - || ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id)); |
| 9 | + return |
| 10 | +#ifdef SAMR_SUPPORT |
| 11 | + ndr_syntax_id_equal(syntax, &ndr_table_samr.syntax_id) || |
| 12 | +#endif |
| 13 | + ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id); |
| 14 | } |
| 15 | |
| 16 | size_t num_pipe_handles(struct pipes_struct *p) |
| 17 | --- a/source3/librpc/rpc/rpc_common.c |
| 18 | +++ b/source3/librpc/rpc/rpc_common.c |
| 19 | @@ -100,9 +100,11 @@ static bool initialize_interfaces(void) |
| 20 | return false; |
| 21 | } |
| 22 | #endif |
| 23 | +#ifdef SAMR_SUPPORT |
| 24 | if (!smb_register_ndr_interface(&ndr_table_samr)) { |
| 25 | return false; |
| 26 | } |
| 27 | +#endif |
| 28 | #ifdef NETLOGON_SUPPORT |
| 29 | if (!smb_register_ndr_interface(&ndr_table_netlogon)) { |
| 30 | return false; |
| 31 | --- a/source3/rpc_server/rpc_ep_setup.c |
| 32 | +++ b/source3/rpc_server/rpc_ep_setup.c |
| 33 | @@ -557,6 +557,7 @@ static bool lsarpc_init_cb(void *ptr) |
| 34 | return true; |
| 35 | } |
| 36 | |
| 37 | +#ifdef SAMR_SUPPORT |
| 38 | static bool samr_init_cb(void *ptr) |
| 39 | { |
| 40 | struct dcesrv_ep_context *ep_ctx = |
| 41 | @@ -605,6 +606,7 @@ static bool samr_init_cb(void *ptr) |
| 42 | |
| 43 | return true; |
| 44 | } |
| 45 | +#endif |
| 46 | |
| 47 | #ifdef NETLOGON_SUPPORT |
| 48 | static bool netlogon_init_cb(void *ptr) |
| 49 | @@ -1111,12 +1113,14 @@ bool dcesrv_ep_setup(struct tevent_conte |
| 50 | return false; |
| 51 | } |
| 52 | |
| 53 | +#ifdef SAMR_SUPPORT |
| 54 | samr_cb.init = samr_init_cb; |
| 55 | samr_cb.shutdown = NULL; |
| 56 | samr_cb.private_data = ep_ctx; |
| 57 | if (!NT_STATUS_IS_OK(rpc_samr_init(&samr_cb))) { |
| 58 | return false; |
| 59 | } |
| 60 | +#endif |
| 61 | |
| 62 | #ifdef NETLOGON_SUPPORT |
| 63 | netlogon_cb.init = netlogon_init_cb; |
| 64 | --- a/source3/smbd/server_exit.c |
| 65 | +++ b/source3/smbd/server_exit.c |
| 66 | @@ -160,7 +160,9 @@ static void exit_server_common(enum serv |
| 67 | #ifdef NETLOGON_SUPPORT |
| 68 | rpc_netlogon_shutdown(); |
| 69 | #endif |
| 70 | +#ifdef SAMR_SUPPORT |
| 71 | rpc_samr_shutdown(); |
| 72 | +#endif |
| 73 | rpc_lsarpc_shutdown(); |
| 74 | } |
| 75 | |
| 76 | --- a/source3/rpcclient/rpcclient.c |
| 77 | +++ b/source3/rpcclient/rpcclient.c |
| 78 | @@ -623,7 +623,9 @@ static struct cmd_set *rpcclient_command |
| 79 | rpcclient_commands, |
| 80 | lsarpc_commands, |
| 81 | ds_commands, |
| 82 | +#ifdef SAMR_SUPPORT |
| 83 | samr_commands, |
| 84 | +#endif |
| 85 | #ifdef PRINTER_SUPPORT |
| 86 | spoolss_commands, |
| 87 | #endif |
| 88 | --- a/source3/smbd/lanman.c |
| 89 | +++ b/source3/smbd/lanman.c |
| 90 | @@ -2353,6 +2353,10 @@ static bool api_RNetGroupEnum(struct smb |
| 91 | NTSTATUS status, result; |
| 92 | struct dcerpc_binding_handle *b; |
| 93 | |
| 94 | +#ifndef SAMR_SUPPORT |
| 95 | + return False; |
| 96 | +#endif |
| 97 | + |
| 98 | if (!str1 || !str2 || !p) { |
| 99 | return False; |
| 100 | } |
| 101 | @@ -2541,6 +2545,10 @@ static bool api_NetUserGetGroups(struct |
| 102 | NTSTATUS status, result; |
| 103 | struct dcerpc_binding_handle *b; |
| 104 | |
| 105 | +#ifndef SAMR_SUPPORT |
| 106 | + return False; |
| 107 | +#endif |
| 108 | + |
| 109 | if (!str1 || !str2 || !UserName || !p) { |
| 110 | return False; |
| 111 | } |
| 112 | @@ -2733,6 +2741,10 @@ static bool api_RNetUserEnum(struct smbd |
| 113 | |
| 114 | struct dcerpc_binding_handle *b; |
| 115 | |
| 116 | +#ifndef SAMR_SUPPORT |
| 117 | + return False; |
| 118 | +#endif |
| 119 | + |
| 120 | if (!str1 || !str2 || !p) { |
| 121 | return False; |
| 122 | } |
| 123 | @@ -2979,6 +2991,10 @@ static bool api_SetUserPassword(struct s |
| 124 | int min_pwd_length; |
| 125 | struct dcerpc_binding_handle *b = NULL; |
| 126 | |
| 127 | +#ifndef SAMR_SUPPORT |
| 128 | + return False; |
| 129 | +#endif |
| 130 | + |
| 131 | /* Skip 2 strings. */ |
| 132 | p = skip_string(param,tpscnt,np); |
| 133 | p = skip_string(param,tpscnt,p); |
| 134 | @@ -3224,6 +3240,10 @@ static bool api_SamOEMChangePassword(str |
| 135 | int bufsize; |
| 136 | struct dcerpc_binding_handle *b; |
| 137 | |
| 138 | +#ifndef SAMR_SUPPORT |
| 139 | + return False; |
| 140 | +#endif |
| 141 | + |
| 142 | *rparam_len = 4; |
| 143 | *rparam = smb_realloc_limit(*rparam,*rparam_len); |
| 144 | if (!*rparam) { |
| 145 | @@ -4265,6 +4285,10 @@ static bool api_RNetUserGetInfo(struct s |
| 146 | union samr_UserInfo *info; |
| 147 | struct dcerpc_binding_handle *b = NULL; |
| 148 | |
| 149 | +#ifndef SAMR_SUPPORT |
| 150 | + return False; |
| 151 | +#endif |
| 152 | + |
| 153 | if (!str1 || !str2 || !UserName || !p) { |
| 154 | return False; |
| 155 | } |
| 156 | |