1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 24 */ 25 26 /* 27 * Message Service 28 */ 29 30 #include <syslog.h> 31 #include <stdlib.h> 32 33 #include <smbsrv/libsmb.h> 34 #include <smbsrv/libmlrpc.h> 35 #include <smbsrv/libmlsvc.h> 36 #include <smbsrv/ndl/msgsvc.ndl> 37 #include <smbsrv/smbinfo.h> 38 #include <smbsrv/nmpipes.h> 39 40 static int msgsvcsend_NetrSendMessage(void *, ndr_xa_t *); 41 42 static ndr_stub_table_t msgsvcsend_stub_table[] = { 43 { msgsvcsend_NetrSendMessage, MSGSVCSEND_OPNUM_NetrSendMessage }, 44 {0} 45 }; 46 47 static ndr_service_t msgsvcsend_service = { 48 "MSGSVC", /* name */ 49 "Message Service", /* desc */ 50 "\\msgsvc", /* endpoint */ 51 PIPE_NTSVCS, /* sec_addr_port */ 52 "5a7b91f8-ff00-11d0-a9b200c04fb6e6fc", 0, /* abstract */ 53 NDR_TRANSFER_SYNTAX_UUID, 2, /* transfer */ 54 0, /* no bind_instance_size */ 55 0, /* no bind_req() */ 56 0, /* no unbind_and_close() */ 57 0, /* use generic_call_stub() */ 58 &TYPEINFO(msgsvcsend_interface), /* interface ti */ 59 msgsvcsend_stub_table /* stub_table */ 60 }; 61 62 void 63 msgsvcsend_initialize(void) 64 { 65 (void) ndr_svc_register(&msgsvcsend_service); 66 } 67 68 static int 69 msgsvcsend_NetrSendMessage(void *arg, ndr_xa_t *mxa) 70 { 71 msgsvcsend_NetrSendMessage_t *param = arg; 72 73 if (!ndr_is_admin(mxa)) { 74 param->status = ERROR_ACCESS_DENIED; 75 return (NDR_DRC_OK); 76 } 77 78 if (param->from == NULL || param->to == NULL || param->text == NULL) { 79 param->status = ERROR_INVALID_PARAMETER; 80 return (NDR_DRC_OK); 81 } 82 83 syslog(LOG_INFO, "%s to %s: %s", param->from, param->to, param->text); 84 param->status = ERROR_SUCCESS; 85 return (NDR_DRC_OK); 86 } 87