Exemplo n.º 1
0
int
procfs_doprocdbregs(PFS_FILL_ARGS)
{
	int error;
	struct dbreg r;
	struct thread *td2;
#ifdef COMPAT_FREEBSD32
	struct dbreg32 r32;
	int wrap32 = 0;
#endif

	if (uio->uio_offset != 0)
		return (0);

	PROC_LOCK(p);
	KASSERT(p->p_lock > 0, ("proc not held"));
	if (p_candebug(td, p) != 0) {
		PROC_UNLOCK(p);
		return (EPERM);
	}

	td2 = FIRST_THREAD_IN_PROC(p);
#ifdef COMPAT_FREEBSD32
	if (SV_CURPROC_FLAG(SV_ILP32)) {
		if (SV_PROC_FLAG(td2->td_proc, SV_ILP32) == 0) {
			PROC_UNLOCK(p);
			return (EINVAL);
		}
		wrap32 = 1;
	}
#endif
	error = PROC(read, dbregs, td2, &r);
	if (error == 0) {
		PROC_UNLOCK(p);
		error = UIOMOVE_FROMBUF(r, uio);
		PROC_LOCK(p);
	}
	if (error == 0 && uio->uio_rw == UIO_WRITE) {
		if (!P_SHOULDSTOP(p)) /* XXXKSE should be P_TRACED? */
			error = EBUSY;
		else
			/* XXXKSE: */
			error = PROC(write, dbregs, td2, &r);
	}
	PROC_UNLOCK(p);

	return (error);
}
Exemplo n.º 2
0
ssize_t
xdr_to_generic_payload(struct iovec inmsg, void *args, xdrproc_t proc,
                       struct iovec *pendingpayload)
{
    XDR xdr;
    ssize_t ret = -1;

    if ((!inmsg.iov_base) || (!args) || (!proc))
        return -1;

    xdrmem_create(&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len,
                  XDR_DECODE);

    if (!PROC(&xdr, args)) {
        ret = -1;
        goto ret;
    }

    ret = xdr_decoded_length(xdr);

    if (pendingpayload) {
        pendingpayload->iov_base = xdr_decoded_remaining_addr(xdr);
        pendingpayload->iov_len = xdr_decoded_remaining_len(xdr);
    }

ret:
    return ret;
}
Exemplo n.º 3
0
static
BOOLEAN
AreLegacyFunctionsSupported(VOID)
{
    int Error;

    if (!PROC(WSACancelBlockingCall) || !PROC(WSAGetLastError))
        return FALSE;

    Error = pWSACancelBlockingCall();
    ok(Error == SOCKET_ERROR, "Error = %d\n", Error);
    ok(pWSAGetLastError() == WSAEOPNOTSUPP ||
       pWSAGetLastError() == WSAEINVAL, "WSAGetLastError = %d\n", pWSAGetLastError());

    return pWSAGetLastError() != WSAEOPNOTSUPP;
}
Exemplo n.º 4
0
BOOL FtpGetFile(Connection *Connect,LPCSTR lpszRemoteFile,LPCSTR lpszNewFile,BOOL Reget,int AsciiMode)
{
	PROC(("FtpGetFile","[%s]->[%s] %s %s",lpszRemoteFile,lpszNewFile,Reget?"REGET":"NEW",AsciiMode?"ASCII":"BIN"));
	String Command,
	       full_name;
	int  ExitCode;
	Assert(Connect && "FtpGetFile");

//mode
	if(AsciiMode && !Connect->ProcessCommand("ascii"))
	{
		Log(("!ascii ascii:%d",AsciiMode));
		return FALSE;
	}
	else if(!AsciiMode && !Connect->ProcessCommand("bin"))
	{
		Log(("!bin ascii:%d",AsciiMode));
		return FALSE;
	}

//Create directory
	Command = lpszNewFile;
	int m = Command.RChr('/');

	if(m != -1)
	{
		Command.SetLength(m);

		if(!DoCreateDirectory(Command.c_str()))
		{
			Log(("!CreateDirectory [%s]",Command.c_str()));
			return FALSE;
		}
	}

//Remote file
	if(Connect->Host.ServerType!=FTP_TYPE_MVS && *lpszRemoteFile != '/')
	{
		full_name = Connect->CurDir; //Connect->ToOEMDup(Connect->CurDir.c_str());
		AddEndSlash(full_name, '/');
		full_name.Add(lpszRemoteFile);
		lpszRemoteFile = full_name.c_str();
	}

//Get file
	Connect->IOCallback = TRUE;

	if(Reget && !Connect->ResumeSupport)
	{
		Connect->AddCmdLine(FMSG(MResumeRestart));
		Reget = FALSE;
	}

	Command.printf("%s \x1%s\x1 \x1%s\x1",
	               Reget ? "reget":"get",
	               lpszRemoteFile, lpszNewFile);
	ExitCode = Connect->ProcessCommand(Command);
	Connect->IOCallback = FALSE;
	return ExitCode;
}
Exemplo n.º 5
0
object *primitive_procedure(primitive_proc proc)
{
    object *p = ALLOC(object);
    TYPE(p) = OBJ_PRIMITIVE_PROCEDURE;
    PROC(p) = proc;
    return p;
}
Exemplo n.º 6
0
void Connection::site(int argc, char *argv[])
{
	PROC(("site","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));
	int  i;
	char buf[BUFSIZ];

	if(argc < 2)
	{
		code = -1;
		return;
	}

	strcpy(buf, Opt.cmdSite);
	strcat(buf, " ");
	strcat(buf, argv[1]);

	for(i = 2; i < argc; i++)
	{
		strcat(buf, " ");
		strcat(buf, argv[i]);
	}

	if(command(buf) == RPL_PRELIM)
		while(getreply(0) == RPL_PRELIM);
}
Exemplo n.º 7
0
/*
 * Receive one file.
 */
int Connection::getit(int argc, char *argv[], int restartit, const char *mode)
{
	PROC(("getit"," %d %s %d [%s,%s,%s]",restartit,mode,argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));

	if(argc == 2)
	{
		argc++;
		argv[2] = argv[1];
	}

	if(argc < 3)
	{
		code = -1;
		return (0);
	}

	if(restartit == -1)
		restart_point = -1;
	else if(restartit)
	{
		restart_point = Fsize(argv[2]);
		Log(("Restart from %I64u",restart_point));
	}

	recvrequest(Opt.cmdRetr, argv[2], argv[1], mode);
	restart_point = 0;
	return 0;
}
Exemplo n.º 8
0
/* change directory to parent directory */
void Connection::cdup()
{
	PROC(("cdup",NULL));

	if(command(Opt.cmdCDUp) >= RPL_COMPLETE && code == 500)
		command(Opt.cmdXCDUp);
}
Exemplo n.º 9
0
/*
 * Get a directory listing
 * of remote files.
 */
void Connection::ls(int argc, char *argv[])
{
	PROC(("ls","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));

	if(argc < 2)
		argc++, argv[1] = NULL;

	if(argc < 3)
		argc++, argv[2] = (char *)"-";

	if(argc > 3)
	{
		code = -1;
		return;
	}

	if(argv[0][0] == 'n')
		recvrequest(Opt.cmdNList, argv[2], argv[1], "w");
	else if(!Host.ExtList)
		recvrequest(Opt.cmdList, argv[2], argv[1], "w");
	else
	{
		recvrequest(Host.ListCMD, argv[2], argv[1], "w");

		if(code > 500 && argv[1] != NULL)
			recvrequest(Opt.cmdList, argv[2], argv[1], "w");
	}
}
Exemplo n.º 10
0
/* restart transfer at specific point */
void Connection::restart(int argc, char *argv[])
{
	PROC(("restart","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));

	if(argc == 2)
		restart_point = atol(argv[1]);
}
Exemplo n.º 11
0
/*
 * Ask the other side for help.
 */
void Connection::rmthelp(int argc, char *argv[])
{
	PROC(("rmthelp","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));
	command(argc == 1 ? "%s" : "%s %s",
	        Opt.cmdHelp,
	        argv[1]);
}
Exemplo n.º 12
0
//---------------------------------------------------------------------------------
void FTP::SaveUsedDirNFile(void)
{
	PROC(("SaveUsedDirNFile","was:(%s,%s)",Host.Home,SelectFile.c_str()))
	PanelInfo pi;

	//Save current file to restore
	if(!ShowHosts && hConnect)
	{
		String s;
		FtpGetCurrentDirectory(hConnect,s);
		StrCpy(Host.Home, s.c_str(), ARRAYSIZE(Host.Home));
	}

	//Save current file to restore
	if(FP_Info->Control(this,FCTL_GETPANELINFO,&pi))
	{
		if(pi.ItemsNumber > 0 && pi.CurrentItem < pi.ItemsNumber)
		{
			SelectFile = FTP_FILENAME(&pi.PanelItems[pi.CurrentItem]);
			Log(("SetLastHost: [%s]", SelectFile.c_str()));
		}

		Log(("Saved (%s,%s)",Host.Home,SelectFile.c_str()));
	}
}
Exemplo n.º 13
0
void Connection::account(int argc,char **argv)
{
	PROC(("account","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));
	String  acct;
	const char *ap;

	if(argc > 1)
	{
		++argv;
		--argc;
		acct = *argv;

		while(argc > 1)
		{
			--argc;
			++argv;
			acct.cat(*argv);
		}

		ap = acct.c_str();
	}
	else
		ap=""; //    ap = getpass("Account:");

	command("%s %s",Opt.cmdAcct,ap);
}
Exemplo n.º 14
0
void Connection::do_umask(int argc, char *argv[])
{
	PROC(("do_umask","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));
	command(argc == 1 ? "%s %s" : "%s %s %s",
	        Opt.cmdSite,
	        Opt.cmdUmask,
	        argv[1]);
}
Exemplo n.º 15
0
/*
 * Set current working directory
 * on remote machine.
 */
void Connection::cd(int argc, char *argv[])
{
	PROC(("cd","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));

	if(argc==2)
		if(command("%s %s",Opt.cmdCwd,argv[1]) >= RPL_COMPLETE && code == 500)
			command("%s %s",Opt.cmdXCwd,argv[1]);
}
Exemplo n.º 16
0
void Connection::idle(int argc, char *argv[])
{
	PROC(("idle","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));
	command(argc == 1 ? "%s %s" : "%s %s %s",
	        Opt.cmdSite,
	        Opt.cmdIdle,
	        argv[1]);
}
Exemplo n.º 17
0
/*
 * Print working directory.
 */
void Connection::pwd()
{
	PROC(("pwd",NULL));

	if(command(Opt.cmdPwd) >= RPL_COMPLETE && code == 500)
	{
		Log(("Try XPWD [%s]",Opt.cmdXPwd));
		command(Opt.cmdXPwd);
	}
}
Exemplo n.º 18
0
/*
 * Terminate session, but don't exit.
 */
void Connection::disconnect()
{
	PROC(("disconnect",NULL));

	if(!connected)
		return;

	command(Opt.cmdQuit);
	cout = 0;
	connected = 0;
	scClose(data_peer, -1);
}
Exemplo n.º 19
0
/*VARARGS*/
void Connection::quit()
{
	PROC(("quit",NULL));

	if(connected)
		disconnect();

	pswitch(1);

	if(connected)
		disconnect();
}
Exemplo n.º 20
0
/*
 * Delete a single file.
 */
void Connection::deleteFile(int argc, char *argv[])
{
	PROC(("deleteFile","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));

	if(argc < 2)
	{
		code = -1;
		return;
	}

	command("%s %s",Opt.cmdDel,argv[1]);
}
Exemplo n.º 21
0
void Connection::do_chmod(int argc, char *argv[])
{
	PROC(("do_chmod","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));

	if(argc != 3)
	{
		code = -1;
		return;
	}

	command("%s %s %s %s", Opt.cmdSite, Opt.cmdChmod, argv[1], argv[2]);
}
Exemplo n.º 22
0
/*
 * get size of file on remote machine
 */
void Connection::sizecmd(int argc, char *argv[])
{
	PROC(("sizecmd","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));

	if(argc < 2)
	{
		code = -1;
		return;
	}

	command("%s %s",Opt.cmdSize,argv[1]);
}
Exemplo n.º 23
0
/*
 * Rename a remote file.
 */
void Connection::renamefile(int argc, char *argv[])
{
	PROC(("renamefile","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));

	if(argc < 3)
	{
		code = -1;
		return;
	}

	if(command("%s %s",Opt.cmdRen,argv[1]) == RPL_CONTINUE)
		command("%s %s",Opt.cmdRenTo,argv[2]);
}
Exemplo n.º 24
0
/*
 * Remove a directory.
 */
void Connection::removedir(int argc, char *argv[])
{
	PROC(("removedir","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));

	if(argc < 2)
	{
		code = -1;
		return;
	}

	if(command("%s %s",Opt.cmdRmd,argv[1]) >= RPL_COMPLETE && code == 500)
		command("%s %s",Opt.cmdXRmd,argv[1]);
}
Exemplo n.º 25
0
void Connection::doproxy(int argc, char *argv[])
{
	PROC(("doproxy","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));
	struct cmd *c;

	if(argc < 2)
	{
		code = -1;
		return;
	}

	c = getcmd(argv[1]);

	//Not found
	if(c == (cmd*)-1 || c == 0)
	{
		WINPORT(SetLastError)(ERROR_BAD_DRIVER_LEVEL);
		code = -1;
		return;
	}

	//Unsupported in proxy mode
	if(!c->c_proxy)
	{
		WINPORT(SetLastError)(ERROR_BAD_NET_RESP);
		code = -1;
		return;
	}

	//Allready in proxy mode
	if(proxy > 0)
		ExecCmdTab(c, argc-1, argv+1);
	else
	{
		//Temp switch to proxy mode
		pswitch(1);

		if(c->c_conn && !connected)
		{
			pswitch(0);
			code = -1;
			return;
		}

		ExecCmdTab(c, argc-1, argv+1);
		proxflag = (connected) ? 1 : 0;
		pswitch(0);
	}
}
Exemplo n.º 26
0
/*
 * Send new user information (re-login)
 */
int Connection::user(int argc, char **argv)
{
	PROC(("user","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));
	char acct[80];
	int n, aflag = 0;

	if(argc < 2 || argc > 4)
	{
		code = -1;
		return (0);
	}

	n = command("%s %s", Opt.cmdUser,argv[1]);

	if(n == RPL_CONTINUE)
	{
		if(argc < 3)
			argv[2] = UserPassword, argc++;

		n = command("%s %s",Opt.cmdPass,argv[2]);
	}

	if(n == RPL_CONTINUE)
	{
		if(argc < 4)
		{
			*acct=0;
			argv[3] = acct;
			argc++;
		}

		n = command("%s %s",Opt.cmdAcct,argv[3]);
		aflag++;
	}

	if(n != RPL_COMPLETE)
	{
		WINPORT(SetLastError)(EPERM);//ERROR_INTERNET_LOGIN_FAILURE);
		return 0;
	}

	if(!aflag && argc == 4)
		command("%s %s",Opt.cmdAcct,argv[3]);

	return 1;
}
Exemplo n.º 27
0
/*
 * get last modification time of file on remote machine
 */
void Connection::modtime(int argc, char *argv[])
{
	PROC(("modtime","%d [%s,%s,%s]",argc,(argc>=1)?argv[0]:"nil",(argc>=2)?argv[1]:"nil",(argc>=3)?argv[2]:"nil"));

	if(argc < 2)
	{
		code = -1;
		return;
	}

	if(command("%s %s",Opt.cmdMDTM,argv[1]) == RPL_COMPLETE)
	{
		int yy, mo, day, hour, min, sec;
		sscanf(reply_string.c_str(),
		       Opt.fmtDateFormat,
		       &yy, &mo, &day, &hour, &min, &sec);
	}
}
Exemplo n.º 28
0
/*
 * Set transfer type.
 */
BOOL Connection::settype(ftTypes Mode,LPCSTR Arg)
{
	PROC(("settype","[%c,%s]",Mode,Arg));
	int comret;

	if(Arg)
		comret = command("TYPE %c %s", Mode, Arg);
	else
		comret = command("TYPE %c", Mode);

	if(comret == RPL_COMPLETE)
	{
		type = Mode;
		Log(("TYPE = %c",Mode));
		return TRUE;
	}
	else
		return FALSE;
}
Exemplo n.º 29
0
ssize_t
xdr_to_generic(struct iovec inmsg, void *args, xdrproc_t proc)
{
    XDR xdr;
    ssize_t ret = -1;

    if ((!inmsg.iov_base) || (!args) || (!proc))
        return -1;

    xdrmem_create(&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len,
                  XDR_DECODE);

    if (!PROC(&xdr, args)) {
        ret = -1;
        goto ret;
    }

    ret = xdr_decoded_length(xdr);
ret:
    return ret;
}
Exemplo n.º 30
0
ssize_t
xdr_serialize_generic(struct iovec outmsg, void *res, xdrproc_t proc)
{
    ssize_t ret = -1;
    XDR xdr;

    if ((!outmsg.iov_base) || (!res) || (!proc))
        return -1;

    xdrmem_create(&xdr, outmsg.iov_base, (unsigned int)outmsg.iov_len,
                  XDR_ENCODE);

    if (!PROC(&xdr, res)) {
        ret = -1;
        goto ret;
    }

    ret = xdr_encoded_length(xdr);

ret:
    return ret;
}