* fhandler.h (fhandler_process::p): New field.
(fhandler_process:fill_filebuf): Revert to same definition as virtual in parent class. (fhandler_process::open): Fill out p field rather than passing as an argument. (fhandler_process::fill_filebuf): Use p pointer rather than argument.
This commit is contained in:
parent
c6d90e842c
commit
ccacec81db
@ -1,3 +1,12 @@
|
|||||||
|
2002-06-30 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* fhandler.h (fhandler_process::p): New field.
|
||||||
|
(fhandler_process:fill_filebuf): Revert to same definition as virtual
|
||||||
|
in parent class.
|
||||||
|
(fhandler_process::open): Fill out p field rather than passing as an
|
||||||
|
argument.
|
||||||
|
(fhandler_process::fill_filebuf): Use p pointer rather than argument.
|
||||||
|
|
||||||
2002-06-29 Pierre Humblet <pierre.humblet@ieee.org>
|
2002-06-29 Pierre Humblet <pierre.humblet@ieee.org>
|
||||||
|
|
||||||
* security.cc (extract_nt_dom_user): Check for all buffer overflows.
|
* security.cc (extract_nt_dom_user): Check for all buffer overflows.
|
||||||
|
@ -1128,13 +1128,14 @@ class fhandler_registry: public fhandler_proc
|
|||||||
struct _pinfo;
|
struct _pinfo;
|
||||||
class fhandler_process: public fhandler_proc
|
class fhandler_process: public fhandler_proc
|
||||||
{
|
{
|
||||||
|
pinfo *p;
|
||||||
public:
|
public:
|
||||||
fhandler_process ();
|
fhandler_process ();
|
||||||
int exists();
|
int exists();
|
||||||
struct dirent *readdir (DIR *);
|
struct dirent *readdir (DIR *);
|
||||||
int open (path_conv *real_path, int flags, mode_t mode = 0);
|
int open (path_conv *real_path, int flags, mode_t mode = 0);
|
||||||
int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
|
int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
|
||||||
void fill_filebuf (pinfo& p);
|
void fill_filebuf ();
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef union
|
typedef union
|
||||||
|
@ -227,12 +227,14 @@ fhandler_process::open (path_conv *pc, int flags, mode_t mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fileid = process_file_no;
|
fileid = process_file_no;
|
||||||
fill_filebuf (p);
|
this->p = &p;
|
||||||
|
fill_filebuf ();
|
||||||
|
|
||||||
if (flags & O_APPEND)
|
if (flags & O_APPEND)
|
||||||
position = filesize;
|
position = filesize;
|
||||||
else
|
else
|
||||||
position = 0;
|
position = 0;
|
||||||
|
this->p = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
success:
|
success:
|
||||||
@ -245,7 +247,7 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_process::fill_filebuf (pinfo& p)
|
fhandler_process::fill_filebuf ()
|
||||||
{
|
{
|
||||||
switch (fileid)
|
switch (fileid)
|
||||||
{
|
{
|
||||||
@ -262,22 +264,22 @@ fhandler_process::fill_filebuf (pinfo& p)
|
|||||||
switch (fileid)
|
switch (fileid)
|
||||||
{
|
{
|
||||||
case PROCESS_PPID:
|
case PROCESS_PPID:
|
||||||
num = p->ppid;
|
num = (*p)->ppid;
|
||||||
break;
|
break;
|
||||||
case PROCESS_UID:
|
case PROCESS_UID:
|
||||||
num = p->uid;
|
num = (*p)->uid;
|
||||||
break;
|
break;
|
||||||
case PROCESS_PGID:
|
case PROCESS_PGID:
|
||||||
num = p->pgid;
|
num = (*p)->pgid;
|
||||||
break;
|
break;
|
||||||
case PROCESS_SID:
|
case PROCESS_SID:
|
||||||
num = p->sid;
|
num = (*p)->sid;
|
||||||
break;
|
break;
|
||||||
case PROCESS_GID:
|
case PROCESS_GID:
|
||||||
num = p->gid;
|
num = (*p)->gid;
|
||||||
break;
|
break;
|
||||||
case PROCESS_CTTY:
|
case PROCESS_CTTY:
|
||||||
num = p->ctty;
|
num = (*p)->ctty;
|
||||||
break;
|
break;
|
||||||
default: // what's this here for?
|
default: // what's this here for?
|
||||||
num = 0;
|
num = 0;
|
||||||
@ -291,11 +293,11 @@ fhandler_process::fill_filebuf (pinfo& p)
|
|||||||
{
|
{
|
||||||
if (!filebuf)
|
if (!filebuf)
|
||||||
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = MAX_PATH);
|
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = MAX_PATH);
|
||||||
if (p->process_state & (PID_ZOMBIE | PID_EXITED))
|
if ((*p)->process_state & (PID_ZOMBIE | PID_EXITED))
|
||||||
strcpy (filebuf, "<defunct>");
|
strcpy (filebuf, "<defunct>");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mount_table->conv_to_posix_path (p->progname, filebuf, 1);
|
mount_table->conv_to_posix_path ((*p)->progname, filebuf, 1);
|
||||||
int len = strlen (filebuf);
|
int len = strlen (filebuf);
|
||||||
if (len > 4)
|
if (len > 4)
|
||||||
{
|
{
|
||||||
@ -311,16 +313,16 @@ fhandler_process::fill_filebuf (pinfo& p)
|
|||||||
{
|
{
|
||||||
if (!filebuf)
|
if (!filebuf)
|
||||||
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 40);
|
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 40);
|
||||||
__small_sprintf (filebuf, "%d\n", p->dwProcessId);
|
__small_sprintf (filebuf, "%d\n", (*p)->dwProcessId);
|
||||||
filesize = strlen (filebuf);
|
filesize = strlen (filebuf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PROCESS_WINEXENAME:
|
case PROCESS_WINEXENAME:
|
||||||
{
|
{
|
||||||
int len = strlen (p->progname);
|
int len = strlen ((*p)->progname);
|
||||||
if (!filebuf)
|
if (!filebuf)
|
||||||
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = (len + 2));
|
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = (len + 2));
|
||||||
strcpy (filebuf, p->progname);
|
strcpy (filebuf, (*p)->progname);
|
||||||
filebuf[len] = '\n';
|
filebuf[len] = '\n';
|
||||||
filesize = len + 1;
|
filesize = len + 1;
|
||||||
break;
|
break;
|
||||||
@ -329,21 +331,21 @@ fhandler_process::fill_filebuf (pinfo& p)
|
|||||||
{
|
{
|
||||||
if (!filebuf)
|
if (!filebuf)
|
||||||
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
|
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
|
||||||
filesize = format_process_status (p, filebuf, bufalloc);
|
filesize = format_process_status ((*p), filebuf, bufalloc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PROCESS_STAT:
|
case PROCESS_STAT:
|
||||||
{
|
{
|
||||||
if (!filebuf)
|
if (!filebuf)
|
||||||
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
|
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
|
||||||
filesize = format_process_stat (p, filebuf, bufalloc);
|
filesize = format_process_stat ((*p), filebuf, bufalloc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PROCESS_STATM:
|
case PROCESS_STATM:
|
||||||
{
|
{
|
||||||
if (!filebuf)
|
if (!filebuf)
|
||||||
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
|
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
|
||||||
filesize = format_process_statm (p, filebuf, bufalloc);
|
filesize = format_process_statm ((*p), filebuf, bufalloc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user