18d7e4166Sjose borrego /* 28d7e4166Sjose borrego * CDDL HEADER START 38d7e4166Sjose borrego * 48d7e4166Sjose borrego * The contents of this file are subject to the terms of the 58d7e4166Sjose borrego * Common Development and Distribution License (the "License"). 68d7e4166Sjose borrego * You may not use this file except in compliance with the License. 78d7e4166Sjose borrego * 88d7e4166Sjose borrego * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 98d7e4166Sjose borrego * or http://www.opensolaris.org/os/licensing. 108d7e4166Sjose borrego * See the License for the specific language governing permissions 118d7e4166Sjose borrego * and limitations under the License. 128d7e4166Sjose borrego * 138d7e4166Sjose borrego * When distributing Covered Code, include this CDDL HEADER in each 148d7e4166Sjose borrego * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 158d7e4166Sjose borrego * If applicable, add the following below this CDDL HEADER, with the 168d7e4166Sjose borrego * fields enclosed by brackets "[]" replaced with your own identifying 178d7e4166Sjose borrego * information: Portions Copyright [yyyy] [name of copyright owner] 188d7e4166Sjose borrego * 198d7e4166Sjose borrego * CDDL HEADER END 208d7e4166Sjose borrego */ 21*148c5f43SAlan Wright 228d7e4166Sjose borrego /* 23*148c5f43SAlan Wright * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 248d7e4166Sjose borrego */ 258d7e4166Sjose borrego 268d7e4166Sjose borrego /* 278d7e4166Sjose borrego * Message Service 288d7e4166Sjose borrego */ 298d7e4166Sjose borrego 308d7e4166Sjose borrego #include <syslog.h> 318d7e4166Sjose borrego #include <stdlib.h> 328d7e4166Sjose borrego 338d7e4166Sjose borrego #include <smbsrv/libsmb.h> 348d7e4166Sjose borrego #include <smbsrv/libmlrpc.h> 358d7e4166Sjose borrego #include <smbsrv/libmlsvc.h> 368d7e4166Sjose borrego #include <smbsrv/ndl/msgsvc.ndl> 378d7e4166Sjose borrego #include <smbsrv/smbinfo.h> 388d7e4166Sjose borrego #include <smbsrv/nmpipes.h> 398d7e4166Sjose borrego 408d7e4166Sjose borrego static int msgsvcsend_NetrSendMessage(void *, ndr_xa_t *); 418d7e4166Sjose borrego 428d7e4166Sjose borrego static ndr_stub_table_t msgsvcsend_stub_table[] = { 438d7e4166Sjose borrego { msgsvcsend_NetrSendMessage, MSGSVCSEND_OPNUM_NetrSendMessage }, 448d7e4166Sjose borrego {0} 458d7e4166Sjose borrego }; 468d7e4166Sjose borrego 478d7e4166Sjose borrego static ndr_service_t msgsvcsend_service = { 488d7e4166Sjose borrego "MSGSVC", /* name */ 498d7e4166Sjose borrego "Message Service", /* desc */ 508d7e4166Sjose borrego "\\msgsvc", /* endpoint */ 518d7e4166Sjose borrego PIPE_NTSVCS, /* sec_addr_port */ 528d7e4166Sjose borrego "5a7b91f8-ff00-11d0-a9b200c04fb6e6fc", 0, /* abstract */ 538d7e4166Sjose borrego NDR_TRANSFER_SYNTAX_UUID, 2, /* transfer */ 548d7e4166Sjose borrego 0, /* no bind_instance_size */ 558d7e4166Sjose borrego 0, /* no bind_req() */ 568d7e4166Sjose borrego 0, /* no unbind_and_close() */ 578d7e4166Sjose borrego 0, /* use generic_call_stub() */ 588d7e4166Sjose borrego &TYPEINFO(msgsvcsend_interface), /* interface ti */ 598d7e4166Sjose borrego msgsvcsend_stub_table /* stub_table */ 608d7e4166Sjose borrego }; 618d7e4166Sjose borrego 628d7e4166Sjose borrego void 638d7e4166Sjose borrego msgsvcsend_initialize(void) 648d7e4166Sjose borrego { 658d7e4166Sjose borrego (void) ndr_svc_register(&msgsvcsend_service); 668d7e4166Sjose borrego } 678d7e4166Sjose borrego 688d7e4166Sjose borrego static int 698d7e4166Sjose borrego msgsvcsend_NetrSendMessage(void *arg, ndr_xa_t *mxa) 708d7e4166Sjose borrego { 718d7e4166Sjose borrego msgsvcsend_NetrSendMessage_t *param = arg; 728d7e4166Sjose borrego 738d7e4166Sjose borrego if (!ndr_is_admin(mxa)) { 748d7e4166Sjose borrego param->status = ERROR_ACCESS_DENIED; 758d7e4166Sjose borrego return (NDR_DRC_OK); 768d7e4166Sjose borrego } 778d7e4166Sjose borrego 788d7e4166Sjose borrego if (param->from == NULL || param->to == NULL || param->text == NULL) { 798d7e4166Sjose borrego param->status = ERROR_INVALID_PARAMETER; 808d7e4166Sjose borrego return (NDR_DRC_OK); 818d7e4166Sjose borrego } 828d7e4166Sjose borrego 838d7e4166Sjose borrego syslog(LOG_INFO, "%s to %s: %s", param->from, param->to, param->text); 848d7e4166Sjose borrego param->status = ERROR_SUCCESS; 858d7e4166Sjose borrego return (NDR_DRC_OK); 868d7e4166Sjose borrego } 87