1/*
2 * Copyright (c) 2000-2001 Boris Popov
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 15 unchanged lines hidden (view full) ---
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $FreeBSD: head/sys/fs/smbfs/smbfs_smb.c 109623 2003-01-21 08:56:16Z alfred $
33 */
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/malloc.h>
38#include <sys/proc.h>
39#include <sys/lock.h>
40#include <sys/vnode.h>
--- 1218 unchanged lines hidden (view full) ---
1259 smb_rq_done(rqp);
1260 return error;
1261}
1262
1263static int
1264smbfs_findopenLM2(struct smbfs_fctx *ctx, struct smbnode *dnp,
1265 const char *wildcard, int wclen, int attr, struct smb_cred *scred)
1266{
1267 ctx->f_name = malloc(SMB_MAXFNAMELEN, M_SMBFSDATA, 0);
1268 if (ctx->f_name == NULL)
1269 return ENOMEM;
1270 ctx->f_infolevel = SMB_DIALECT(SSTOVC(ctx->f_ssp)) < SMB_DIALECT_NTLM0_12 ?
1271 SMB_INFO_STANDARD : SMB_FIND_FILE_DIRECTORY_INFO;
1272 ctx->f_attrmask = attr;
1273 ctx->f_wildcard = wildcard;
1274 ctx->f_wclen = wclen;
1275 return 0;
--- 90 unchanged lines hidden (view full) ---
1366 if (ctx->f_rnameofs && (ctx->f_flags & SMBFS_RDD_GOTRNAME) == 0 &&
1367 (ctx->f_rnameofs >= ctx->f_eofs && ctx->f_rnameofs < next)) {
1368 /*
1369 * Server needs a resume filename.
1370 */
1371 if (ctx->f_rnamelen <= nmlen) {
1372 if (ctx->f_rname)
1373 free(ctx->f_rname, M_SMBFSDATA);
1374 ctx->f_rname = malloc(nmlen + 1, M_SMBFSDATA, 0);
1375 ctx->f_rnamelen = nmlen;
1376 }
1377 bcopy(ctx->f_name, ctx->f_rname, nmlen);
1378 ctx->f_rname[nmlen] = 0;
1379 ctx->f_flags |= SMBFS_RDD_GOTRNAME;
1380 }
1381 ctx->f_nmlen = nmlen;
1382 ctx->f_eofs = next;
--- 16 unchanged lines hidden (view full) ---
1399
1400int
1401smbfs_findopen(struct smbnode *dnp, const char *wildcard, int wclen, int attr,
1402 struct smb_cred *scred, struct smbfs_fctx **ctxpp)
1403{
1404 struct smbfs_fctx *ctx;
1405 int error;
1406
1407 ctx = malloc(sizeof(*ctx), M_SMBFSDATA, 0);
1408 if (ctx == NULL)
1409 return ENOMEM;
1410 bzero(ctx, sizeof(*ctx));
1411 ctx->f_ssp = dnp->n_mount->sm_share;
1412 ctx->f_dnp = dnp;
1413 ctx->f_flags = SMBFS_RDD_FINDFIRST;
1414 ctx->f_scred = scred;
1415 if (SMB_DIALECT(SSTOVC(ctx->f_ssp)) < SMB_DIALECT_LANMAN2_0 ||
--- 91 unchanged lines hidden ---
2 * Copyright (c) 2000-2001 Boris Popov
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 15 unchanged lines hidden (view full) ---
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $FreeBSD: head/sys/fs/smbfs/smbfs_smb.c 109623 2003-01-21 08:56:16Z alfred $
33 */
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/malloc.h>
38#include <sys/proc.h>
39#include <sys/lock.h>
40#include <sys/vnode.h>
--- 1218 unchanged lines hidden (view full) ---
1259 smb_rq_done(rqp);
1260 return error;
1261}
1262
1263static int
1264smbfs_findopenLM2(struct smbfs_fctx *ctx, struct smbnode *dnp,
1265 const char *wildcard, int wclen, int attr, struct smb_cred *scred)
1266{
1267 ctx->f_name = malloc(SMB_MAXFNAMELEN, M_SMBFSDATA, 0);
1268 if (ctx->f_name == NULL)
1269 return ENOMEM;
1270 ctx->f_infolevel = SMB_DIALECT(SSTOVC(ctx->f_ssp)) < SMB_DIALECT_NTLM0_12 ?
1271 SMB_INFO_STANDARD : SMB_FIND_FILE_DIRECTORY_INFO;
1272 ctx->f_attrmask = attr;
1273 ctx->f_wildcard = wildcard;
1274 ctx->f_wclen = wclen;
1275 return 0;
--- 90 unchanged lines hidden (view full) ---
1366 if (ctx->f_rnameofs && (ctx->f_flags & SMBFS_RDD_GOTRNAME) == 0 &&
1367 (ctx->f_rnameofs >= ctx->f_eofs && ctx->f_rnameofs < next)) {
1368 /*
1369 * Server needs a resume filename.
1370 */
1371 if (ctx->f_rnamelen <= nmlen) {
1372 if (ctx->f_rname)
1373 free(ctx->f_rname, M_SMBFSDATA);
1374 ctx->f_rname = malloc(nmlen + 1, M_SMBFSDATA, 0);
1375 ctx->f_rnamelen = nmlen;
1376 }
1377 bcopy(ctx->f_name, ctx->f_rname, nmlen);
1378 ctx->f_rname[nmlen] = 0;
1379 ctx->f_flags |= SMBFS_RDD_GOTRNAME;
1380 }
1381 ctx->f_nmlen = nmlen;
1382 ctx->f_eofs = next;
--- 16 unchanged lines hidden (view full) ---
1399
1400int
1401smbfs_findopen(struct smbnode *dnp, const char *wildcard, int wclen, int attr,
1402 struct smb_cred *scred, struct smbfs_fctx **ctxpp)
1403{
1404 struct smbfs_fctx *ctx;
1405 int error;
1406
1407 ctx = malloc(sizeof(*ctx), M_SMBFSDATA, 0);
1408 if (ctx == NULL)
1409 return ENOMEM;
1410 bzero(ctx, sizeof(*ctx));
1411 ctx->f_ssp = dnp->n_mount->sm_share;
1412 ctx->f_dnp = dnp;
1413 ctx->f_flags = SMBFS_RDD_FINDFIRST;
1414 ctx->f_scred = scred;
1415 if (SMB_DIALECT(SSTOVC(ctx->f_ssp)) < SMB_DIALECT_LANMAN2_0 ||
--- 91 unchanged lines hidden ---