All pastes #2090825 Raw Edit

Someone

public text v1 · immutable
#2090825 ·published 2011-10-17 15:12 UTC
rendered paste body
#!/usr/sbin/dtrace -Cs

#pragma D option flowindent

/* typedef uint16_t	sa_family_t; */

/* type redeclared: struct sockaddr */
/* struct sockaddr { */
/* 	sa_family_t	sa_family;	/\* address family *\/ */
/* 	char		sa_data[14];	/\* up to 14 bytes of direct address *\/ */
/* }; */

/* struct sockaddr_in { */
/* 	sa_family_t	sin_family; */
/* 	in_port_t	sin_port; */
/* 	struct	in_addr sin_addr; */
/* 	char		sin_zero[8]; */
/* }; */

/* struct smbioc_ssn_work { */
/* 	smb_iods_t	wk_iods; */
/* 	smb_sopt_t	wk_sopt; */
/* 	int		wk_out_state; */
/* }; */
/* /\* typedef struct smbioc_ssn_work smbioc_ssn_work_t; *\/ */

#define	SMBIOC_HASH_SZ	16

#define	NTLM_CHAL_SZ		8	/* challenge size */

#define	SMBIOC_MAX_NAME		256

union smbioc_sockaddr {
	struct sockaddr sa;	/* generic */
	struct sockaddr_in sin;
	struct sockaddr_in6 sin6;
};
/* typedef union smbioc_sockaddr smbioc_sockaddr_t; */

struct smbioc_ssn_ident {
	smbioc_sockaddr_t id_srvaddr;
	char		id_domain[SMBIOC_MAX_NAME];
	char		id_user[SMBIOC_MAX_NAME];
};
/* typedef struct smbioc_ssn_ident smbioc_ssn_ident_t; */

struct smbioc_ossn {
	uint32_t		ssn_vopt;	/* i.e. SMBVOPT_CREATE */
	uint32_t		ssn_owner;	/* Unix owner (UID) */
	smbioc_ssn_ident_t	ssn_id;
	char			ssn_srvname[SMBIOC_MAX_NAME];
};

#define	NTLM_HASH_SZ		SMBIOC_HASH_SZ

struct smb_iod_ssn {
	struct smbioc_ossn iod_ossn;
	int		iod_authflags;	/* SMB_AT_x */
	uchar_t		iod_nthash[NTLM_HASH_SZ];
	uchar_t		iod_lmhash[NTLM_HASH_SZ];
	/* Kerberos cred. cache res. name? */
};
/* typedef struct smb_iod_ssn smb_iod_ssn_t; */

struct smb_ctx {
	int		ct_flags;	/* SMBCF_ */
	int		ct_dev_fd;	/* device handle */
	int		ct_door_fd;	/* to smbiod */
	int		ct_parsedlevel;
	int		ct_minlevel;
	int		ct_maxlevel;
	char		*ct_fullserver; /* orig. server name from cmd line */
	char		*ct_srvaddr_s;	/* hostname or IP address of server */
	struct addrinfo *ct_addrinfo;	/* IP addresses of the server */
	struct nb_ctx	*ct_nb;		/* NetBIOS info. */
	char		*ct_locname;	/* local (machine) name */
	struct smb_iod_ssn	ct_iod_ssn;
	/* smbioc_oshare_t	ct_sh; XXX */
	int		ct_minauth;
	int		ct_shtype_req;	/* share type wanted */
	char		*ct_origshare;
	char		*ct_home;
	char		*ct_rpath;	/* remote file name */

	/* Connection setup SMB stuff. */
	/* Strings from the SMB negotiate response. */
	char		*ct_srv_OS;
	char		*ct_srv_LM;

	/* NTLM auth. stuff */
	uchar_t		ct_clnonce[NTLM_CHAL_SZ];
	uchar_t		ct_ntlm_chal[NTLM_CHAL_SZ];
	char		ct_password[SMBIOC_MAX_NAME];

	/* See ssp.c */
	void		*ct_ssp_ctx;
	smbioc_ssn_work_t ct_work;
};

/* fbt:smbsrv::entry */
/* { */

/* } */

pid$target::smb_ctx_setfullserver:entry
{
	this->ctx = (struct smb_ctx*)copyin(arg0, sizeof (struct smb_ctx));

	printf("name: %s\n", copyinstr(arg1));

	/* OK */
	/* printf("ct_minlevel: %d, ct_maxlevel: %d\n", */
	/*        this->ctx->ct_minlevel, */
	/*        this->ctx->ct_maxlevel); */
}

pid$target::smb_ctx_setfullserver:return
{
	this->ctx = (struct smb_ctx*)copyin(arg0, sizeof (struct smb_ctx));

/* dtrace: error on enabled probe ID 2 (ID 70901: pid102694:libsmbfs.so.1:smb_ctx_setfullserver:return): invalid address (0x52) in action #1 at DIF offset 40 */
	printf("ct_minlevel: %d, ct_maxlevel: %d\n",
	       this->ctx->ct_minlevel,
	       this->ctx->ct_maxlevel);

	/* printf("ctx->ct_fullserver[0]: %c\n", this->ctx->ct_fullserver[0]); */

	/* printf("ctx->ct_fullserver: %s\n", */
	/*        this->ctx->ct_fullserver != NULL ? */
	/*        stringof(this->ctx->ct_fullserver) : "<NULL>" */
	/*        ); */

	exit(0);
}