430b4c467020edf2445feb0c21db01c88b86243aGordon Ross * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Copyright (c) 2000, Boris Popov
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * All rights reserved.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Redistribution and use in source and binary forms, with or without
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * modification, are permitted provided that the following conditions
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * 1. Redistributions of source code must retain the above copyright
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * notice, this list of conditions and the following disclaimer.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * 2. Redistributions in binary form must reproduce the above copyright
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * notice, this list of conditions and the following disclaimer in the
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * documentation and/or other materials provided with the distribution.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * 3. All advertising materials mentioning features or use of this software
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * must display the following acknowledgement:
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * This product includes software developed by Boris Popov.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * 4. Neither the name of the author nor the names of any co-contributors
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * may be used to endorse or promote products derived from this software
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * without specific prior written permission.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * SUCH DAMAGE.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * $Id: rap.c,v 1.5 2004/12/13 00:25:23 lindak Exp $
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * This is very simple implementation of RAP protocol.
4bff34e37def8a90f9194d81bc345c52ba20086athurlowsmb_rap_parserqparam(const char *s, char **next, int *rlen)
4bff34e37def8a90f9194d81bc345c52ba20086athurlow switch (*s++) {
4bff34e37def8a90f9194d81bc345c52ba20086athurlow *(const char **)next = s;
4bff34e37def8a90f9194d81bc345c52ba20086athurlow return (0);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowsmb_rap_parserpparam(const char *s, char **next, int *rlen)
4bff34e37def8a90f9194d81bc345c52ba20086athurlow switch (*s++) {
4bff34e37def8a90f9194d81bc345c52ba20086athurlow *(const char **)next = s;
4bff34e37def8a90f9194d81bc345c52ba20086athurlow return (0);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowsmb_rap_parserpdata(const char *s, char **next, int *rlen)
4bff34e37def8a90f9194d81bc345c52ba20086athurlow switch (*s++) {
4bff34e37def8a90f9194d81bc345c52ba20086athurlow *(const char **)next = s;
4bff34e37def8a90f9194d81bc345c52ba20086athurlow return (0);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowsmb_rap_rqparam_z(struct smb_rap *rap, const char *value)
4bff34e37def8a90f9194d81bc345c52ba20086athurlow return (0);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Marshal RAP request parameters.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Note: value is in host order.
4bff34e37def8a90f9194d81bc345c52ba20086athurlowsmb_rap_rqparam(struct smb_rap *rap, char ptype, char plen, int value)
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /* LINTED */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /* LINTED */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow return (0);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowsmb_rap_create(int fn, const char *param, const char *data,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Calculate length of request parameter block
4bff34e37def8a90f9194d81bc345c52ba20086athurlow while (*p) {
4bff34e37def8a90f9194d81bc345c52ba20086athurlow return (0);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /* FALLTHROUGH */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow return (0);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow return (0);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /* LINTED */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow return (0);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowsmb_rap_request(struct smb_rap *rap, struct smb_ctx *ctx)
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross int error, rdatacnt, rparamcnt, entries, done, dlen, buffer_oflow;
4bff34e37def8a90f9194d81bc345c52ba20086athurlow rap->r_plen, rap->r_pbuf, /* int tparamcnt,void *tparam */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow &rparamcnt, rap->r_pbuf, /* rparamcnt, void *rparam */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow &rdatacnt, rap->r_rcvbuf, /* int *rdatacnt, void *rdata */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /* LINTED */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Note: First is a "LanMan API" error code.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Could also return zero and let the caller
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * come get r_result via smb_rap_error(),
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * but in case they dont...
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /* Save the returned data length */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow while (!done && *p) {
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /* LINTED */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#if 0 /* commented out in Darwin. Why? */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow "reply parameter mismatch %s"), 0, p);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * In general, unpacking entries we may need to relocate
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * entries for proper aligning. For now use them as is.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow while (*p) {
4bff34e37def8a90f9194d81bc345c52ba20086athurlow "reply data mismatch %s"), 0, p);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /* LINTED */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow return (0);