Ejemplo n.º 1
0
qConfig() {
	string p = file_name(previous_object());
# ifdef __COMPAT_MODE__
	p = "/"+p;
# endif
	P3(("\n%O: config requested by %s\n", ME, p))
# if USE_ICQ_GATEWAY
	if (abbrev(GATEWAY_PATH "icq", p)) return
	       (["host" : "icq.localhost",
                 "port" : 5234,
                 "scheme" : "icq",
                 "name" : "icqlinker",
                 "secret" : "myicqsecret",
		 "nickname" : "your uin here",
                 "password" : "and your password please" ]);
# endif
# if USE_AIM_GATEWAY
	if (abbrev(GATEWAY_PATH "aim2", p)) return
	       (["host" : "aim.localhost",
                 "port" : 5233,
                 "scheme" : "aim",
                 "name" : "aimlinker",
                 "secret" : "myaimsecret",
		 "nickname" : "screen name",
                 "password" : "and your password please" ]);
# endif
}
Ejemplo n.º 2
0
static void
btrfs_print_tree_search(struct tcb *tcp, struct btrfs_ioctl_search_key *key,
			uint64_t buf_addr, uint64_t buf_size, bool print_size)
{
	if (entering(tcp)) {
		tprintf("{key={tree_id=");
		btrfs_print_objectid(key->tree_id);

		if (key->min_objectid != BTRFS_FIRST_FREE_OBJECTID ||
		    !abbrev(tcp)) {
			tprints(", min_objectid=");
			btrfs_print_objectid(key->min_objectid);
		}

		if (key->max_objectid != BTRFS_LAST_FREE_OBJECTID ||
		    !abbrev(tcp)) {
			tprints(", max_objectid=");
			btrfs_print_objectid(key->max_objectid);
		}

		print_key_value(tcp, key, min_offset);
		print_key_value(tcp, key, max_offset);
		print_key_value(tcp, key, min_transid);
		print_key_value(tcp, key, max_transid);

		tprints(", min_type=");
		btrfs_print_key_type(key->min_type);
		tprints(", max_type=");
		btrfs_print_key_type(key->max_type);
		tprintf(", nr_items=%u}", key->nr_items);
		if (print_size)
			tprintf(", buf_size=%" PRIu64, buf_size);
		tprints("}");
	} else {
		tprintf("{key={nr_items=%u}", key->nr_items);
		if (print_size)
			tprintf(", buf_size=%" PRIu64, buf_size);
		tprints(", buf=");
		if (abbrev(tcp))
			tprints("...");
		else {
			struct btrfs_ioctl_search_header sh;

			print_array(tcp, buf_addr, key->nr_items,
				    &sh, sizeof(sh),
				    umoven_or_printaddr,
				    print_btrfs_ioctl_search_header, 0);
		}
		tprints("}");
	}
}
Ejemplo n.º 3
0
void
print_struct_stat(struct tcb *tcp, const struct strace_stat *const st)
{
	tprints("{");
	if (!abbrev(tcp)) {
		tprintf("st_dev=makedev(%u, %u), st_ino=%llu, st_mode=",
			(unsigned int) major(st->dev),
			(unsigned int) minor(st->dev),
			st->ino);
		print_symbolic_mode_t(st->mode);
		tprintf(", st_nlink=%llu, st_uid=%llu, st_gid=%llu",
			st->nlink, st->uid, st->gid);
		tprintf(", st_blksize=%llu", st->blksize);
		tprintf(", st_blocks=%llu", st->blocks);
	} else {
		tprints("st_mode=");
		print_symbolic_mode_t(st->mode);
	}

	switch (st->mode & S_IFMT) {
	case S_IFCHR: case S_IFBLK:
		tprintf(", st_rdev=makedev(%u, %u)",
			(unsigned int) major(st->rdev),
			(unsigned int) minor(st->rdev));
		break;
	default:
		tprintf(", st_size=%llu", st->size);
		break;
	}

	if (!abbrev(tcp)) {
		tprints(", st_atime=");
		tprints(sprinttime(st->atime));
		if (st->atime_nsec)
			tprintf(".%09llu", st->atime_nsec);
		tprints(", st_mtime=");
		tprints(sprinttime(st->mtime));
		if (st->mtime_nsec)
			tprintf(".%09llu", st->mtime_nsec);
		tprints(", st_ctime=");
		tprints(sprinttime(st->ctime));
		if (st->ctime_nsec)
			tprintf(".%09llu", st->ctime_nsec);
	} else {
		tprints(", ...");
	}
	tprints("}");
}
Ejemplo n.º 4
0
static void
btrfs_print_logical_ino_container(struct tcb *tcp,
				  const uint64_t inodes_addr)
{
	struct btrfs_data_container container;

	if (umove_or_printaddr(tcp, inodes_addr, &container))
		return;

	btrfs_print_data_container_header(&container);

	if (abbrev(tcp)) {
		tprints("...");
	} else {
		const uint64_t val_addr =
			inodes_addr + offsetof(typeof(container), val);
		uint64_t record[3];
		print_array(tcp, val_addr, container.elem_cnt / 3,
			    record, sizeof(record),
			    umoven_or_printaddr,
			    print_btrfs_data_container_logical_ino, 0);
	}

	btrfs_print_data_container_footer();
}
Ejemplo n.º 5
0
static void
btrfs_print_ino_path_container(struct tcb *tcp,
			       const uint64_t fspath_addr)
{
	struct btrfs_data_container container;

	if (umove_or_printaddr(tcp, fspath_addr, &container))
		return;

	btrfs_print_data_container_header(&container);

	if (abbrev(tcp)) {
		tprints("...");
	} else {
		uint64_t val_addr =
			fspath_addr + offsetof(typeof(container), val);
		uint64_t offset;
		print_array(tcp, val_addr, container.elem_cnt,
			    &offset, sizeof(offset),
			    umoven_or_printaddr,
			    print_btrfs_data_container_ino_path, &val_addr);
	}

	btrfs_print_data_container_footer();
}
Ejemplo n.º 6
0
static void
btrfs_print_qgroup_inherit(struct tcb *tcp, const uint64_t qgi_addr)
{
	struct btrfs_qgroup_inherit inherit;

	if (umove_or_printaddr(tcp, qgi_addr, &inherit))
		return;

	tprintf("{flags=");
	printflags64(btrfs_qgroup_inherit_flags, inherit.flags,
		     "BTRFS_QGROUP_INHERIT_???");
	tprintf(", num_qgroups=%" PRI__u64 ", num_ref_copies=%" PRI__u64
		", num_excl_copies=%" PRI__u64 ", lim=",
		inherit.num_qgroups, inherit.num_ref_copies,
		inherit.num_excl_copies);

	btrfs_print_qgroup_limit(&inherit.lim);

	tprints(", qgroups=");

	if (abbrev(tcp)) {
		tprints("...");
	} else {
		uint64_t record;
		print_array(tcp, qgi_addr + offsetof(typeof(inherit), qgroups),
			    inherit.num_qgroups, &record, sizeof(record),
			    umoven_or_printaddr, print_uint64, 0);
	}
	tprints("}");
}
Ejemplo n.º 7
0
static int
keycode_V2_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
	tprints(", ");

	struct input_keymap_entry ike;

	if (umove_or_printaddr(tcp, arg, &ike))
		return 1;

	tprintf("{flags=%" PRIu8
		", len=%" PRIu8 ", ",
		ike.flags,
		ike.len);

	if (!abbrev(tcp)) {
		unsigned int i;

		tprintf("index=%" PRIu16 ", keycode=", ike.index);
		printxval(evdev_keycode, ike.keycode, "KEY_???");
		tprints(", scancode=[");
		for (i = 0; i < ARRAY_SIZE(ike.scancode); i++) {
			if (i > 0)
				tprints(", ");
			tprintf("%" PRIx8, ike.scancode[i]);
		}
		tprints("]");
	} else {
		tprints("...");
	}

	tprints("}");

	return 1;
}
Ejemplo n.º 8
0
static int
abs_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
	tprints(", ");

	struct input_absinfo absinfo;

	if (!umove_or_printaddr(tcp, arg, &absinfo)) {
		tprintf("{value=%u"
			", minimum=%u, ",
			absinfo.value,
			absinfo.minimum);

		if (!abbrev(tcp)) {
			tprintf("maximum=%u"
				", fuzz=%u"
				", flat=%u",
				absinfo.maximum,
				absinfo.fuzz,
				absinfo.flat);
# ifdef HAVE_STRUCT_INPUT_ABSINFO_RESOLUTION
			tprintf(", resolution=%u",
				absinfo.resolution);
# endif
		} else {
			tprints("...");
		}

		tprints("}");
	}

	return 1;
}
Ejemplo n.º 9
0
Archivo: gram.c Proyecto: joequant/iraf
/* Search though string table, tbl, for string s. last pointer in table
 * should be NULL, ie, tbl[last] == NULL (not *tbl[last] == '\0').
 * Settle for an abbreviation if they are enabled.  Return KWBAD if s
 * simply not in tbl at all, KWAMBIG if abbreviations are enabled and more
 * than one entry in tbl would match s, else the ordinal (index) into tbl
 * at which s matched.
 */
int 
keyword (register char *tbl[], register char *s)
{
	register int i;
	register char *kentry;
	int	cand, len;

	i = 0;
	cand = KWBAD;
	len = strlen (s);

	if (abbrev()) {
	    for (kentry = tbl[0]; kentry; kentry = tbl[++i])
		if (!strncmp (s, kentry, len)) {
		    if (kentry[len] == '\0')
			return (i); 		/* exact hit */
		    if (cand == KWBAD)
			cand = i;
		    else
			cand = KWAMBIG; 	/* might still hit exact */
		}

	} else for (kentry = tbl[0]; kentry; kentry = tbl[++i])
	    if (!strcmp (s, kentry))
		return (i);

	return (cand);
}
Ejemplo n.º 10
0
void
printrusage(struct tcb *tcp, long addr)
{
	struct rusage ru;

	if (!addr)
		tprints("NULL");
	else if (syserror(tcp) || !verbose(tcp))
		tprintf("%#lx", addr);
	else if (umove(tcp, addr, &ru) < 0)
		tprints("{...}");
	else if (!abbrev(tcp)) {
		tprintf("{ru_utime={%lu, %lu}, ru_stime={%lu, %lu}, ",
			(long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec,
			(long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec);
		tprintf("ru_maxrss=%lu, ru_ixrss=%lu, ",
			ru.ru_maxrss, ru.ru_ixrss);
		tprintf("ru_idrss=%lu, ru_isrss=%lu, ",
			ru.ru_idrss, ru.ru_isrss);
		tprintf("ru_minflt=%lu, ru_majflt=%lu, ru_nswap=%lu, ",
			ru.ru_minflt, ru.ru_majflt, ru.ru_nswap);
		tprintf("ru_inblock=%lu, ru_oublock=%lu, ",
			ru.ru_inblock, ru.ru_oublock);
		tprintf("ru_msgsnd=%lu, ru_msgrcv=%lu, ",
			ru.ru_msgsnd, ru.ru_msgrcv);
		tprintf("ru_nsignals=%lu, ru_nvcsw=%lu, ru_nivcsw=%lu}",
			ru.ru_nsignals, ru.ru_nvcsw, ru.ru_nivcsw);
	}
	else {
		tprintf("{ru_utime={%lu, %lu}, ru_stime={%lu, %lu}, ...}",
			(long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec,
			(long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec);
	}
}
Ejemplo n.º 11
0
static void
decode_execve(struct tcb *tcp, const unsigned int index)
{
	printpath(tcp, tcp->u_arg[index + 0]);
	tprints(", ");

	if (!tcp->u_arg[index + 1] || !verbose(tcp))
		printaddr(tcp->u_arg[index + 1]);
	else {
		tprints("[");
		printargv(tcp, tcp->u_arg[index + 1]);
		tprints("]");
	}
	tprints(", ");

	if (!tcp->u_arg[index + 2] || !verbose(tcp))
		printaddr(tcp->u_arg[index + 2]);
	else if (abbrev(tcp))
		printargc("[/* %d var%s */]", tcp, tcp->u_arg[index + 2]);
	else {
		tprints("[");
		printargv(tcp, tcp->u_arg[index + 2]);
		tprints("]");
	}
}
Ejemplo n.º 12
0
static void
decode_fprog(struct tcb *tcp, unsigned short len, unsigned long addr)
{
	if (!len || abbrev(tcp)) {
		tprintf("{len = %u, filter = ", len);
		printaddr(addr);
		tprints("}");
	} else {
		unsigned int i = 0;

		tprints("[");
		while (i < len && i < BPF_MAXINSNS) {
			struct bpf_filter filter;

			if (umove(tcp, addr, &filter) < 0)
				break;
			if (i)
				tprints(", ");
			decode_filter(&filter);

			addr += sizeof(filter);
			++i;
		}
		if (i < len)
			tprints("...");
		tprints("]");
	}
}
Ejemplo n.º 13
0
int
sys_mincore(struct tcb *tcp)
{
	if (entering(tcp)) {
		tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
	} else {
		unsigned long i, len;
		char *vec = NULL;

		len = tcp->u_arg[1];
		if (syserror(tcp) || tcp->u_arg[2] == 0 ||
			(vec = malloc(len)) == NULL ||
			umoven(tcp, tcp->u_arg[2], len, vec) < 0)
			tprintf("%#lx", tcp->u_arg[2]);
		else {
			tprints("[");
			for (i = 0; i < len; i++) {
				if (abbrev(tcp) && i >= max_strlen) {
					tprints("...");
					break;
				}
				tprints((vec[i] & 1) ? "1" : "0");
			}
			tprints("]");
		}
		free(vec);
	}
	return 0;
}
Ejemplo n.º 14
0
static void
printargv(struct tcb *tcp, long addr)
{
	union {
		unsigned int p32;
		unsigned long p64;
		char data[sizeof(long)];
	} cp;
	const char *sep;
	unsigned int n = 0;
	unsigned wordsize = current_wordsize;

	cp.p64 = 1;
	for (sep = ""; !abbrev(tcp) || n < max_strlen / 2; sep = ", ", ++n) {
		if (umoven(tcp, addr, wordsize, cp.data) < 0) {
			tprintf("%#lx", addr);
			return;
		}
		if (wordsize == 4)
			cp.p64 = cp.p32;
		if (cp.p64 == 0)
			break;
		tprints(sep);
		printstr(tcp, cp.p64, -1);
		addr += wordsize;
	}
	if (cp.p64)
		tprintf("%s...", sep);
}
Ejemplo n.º 15
0
static void
decode_termios(struct tcb *const tcp, const kernel_ulong_t addr)
{
	struct termios tios;

	tprints(", ");
	if (umove_or_printaddr(tcp, addr, &tios))
		return;
	if (abbrev(tcp)) {
		tprints("{");
		printxval(baud_options, tios.c_cflag & CBAUD, "B???");
		tprintf(" %sopost %sisig %sicanon %secho ...}",
			(tios.c_oflag & OPOST) ? "" : "-",
			(tios.c_lflag & ISIG) ? "" : "-",
			(tios.c_lflag & ICANON) ? "" : "-",
			(tios.c_lflag & ECHO) ? "" : "-");
		return;
	}
	tprintf("{c_iflags=%#lx, c_oflags=%#lx, ",
		(long) tios.c_iflag, (long) tios.c_oflag);
	tprintf("c_cflags=%#lx, c_lflags=%#lx, ",
		(long) tios.c_cflag, (long) tios.c_lflag);
	tprintf("c_line=%u, ", tios.c_line);
	if (!(tios.c_lflag & ICANON))
		tprintf("c_cc[VMIN]=%d, c_cc[VTIME]=%d, ",
			tios.c_cc[VMIN], tios.c_cc[VTIME]);
	tprints("c_cc=");
	print_quoted_string((char *) tios.c_cc, NCCS, QUOTE_FORCE_HEX);
	tprints("}");
}
Ejemplo n.º 16
0
Archivo: uid.c Proyecto: MoroJr/strace
int
sys_getgroups(struct tcb *tcp)
{
	unsigned long len;

	if (entering(tcp)) {
		len = tcp->u_arg[0];
		tprintf("%lu, ", len);
	} else {
		unsigned long size, start, cur, end, abbrev_end;
		uid_t gid;
		int failed = 0;

		start = tcp->u_arg[1];
		if (start == 0) {
			tprints("NULL");
			return 0;
		}
		len = tcp->u_rval;
		if (len == 0) {
			tprints("[]");
			return 0;
		}
		size = len * sizeof(gid);
		end = start + size;
		if (!verbose(tcp) || tcp->u_arg[0] == 0 ||
		    size / sizeof(gid) != len || end < start) {
			tprintf("%#lx", start);
			return 0;
		}
		if (abbrev(tcp)) {
			abbrev_end = start + max_strlen * sizeof(gid);
			if (abbrev_end < start)
				abbrev_end = end;
		} else {
			abbrev_end = end;
		}
		tprints("[");
		for (cur = start; cur < end; cur += sizeof(gid)) {
			if (cur > start)
				tprints(", ");
			if (cur >= abbrev_end) {
				tprints("...");
				break;
			}
			if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) {
				tprints("?");
				failed = 1;
				break;
			}
			tprintf("%u", (unsigned int) gid);
		}
		tprints("]");
		if (failed)
			tprintf(" %#lx", tcp->u_arg[1]);
	}
	return 0;
}
Ejemplo n.º 17
0
void
printrusage32(struct tcb *tcp, long addr)
{
	struct timeval32 {
		unsigned tv_sec;
		unsigned tv_usec;
	};
	struct rusage32 {
		struct timeval32 ru_utime;	/* user time used */
		struct timeval32 ru_stime;	/* system time used */
		long	ru_maxrss;		/* maximum resident set size */
		long	ru_ixrss;		/* integral shared memory size */
		long	ru_idrss;		/* integral unshared data size */
		long	ru_isrss;		/* integral unshared stack size */
		long	ru_minflt;		/* page reclaims */
		long	ru_majflt;		/* page faults */
		long	ru_nswap;		/* swaps */
		long	ru_inblock;		/* block input operations */
		long	ru_oublock;		/* block output operations */
		long	ru_msgsnd;		/* messages sent */
		long	ru_msgrcv;		/* messages received */
		long	ru_nsignals;		/* signals received */
		long	ru_nvcsw;		/* voluntary context switches */
		long	ru_nivcsw;		/* involuntary " */
	} ru;

	if (!addr)
		tprints("NULL");
	else if (syserror(tcp) || !verbose(tcp))
		tprintf("%#lx", addr);
	else if (umove(tcp, addr, &ru) < 0)
		tprints("{...}");
	else if (!abbrev(tcp)) {
		tprintf("{ru_utime={%lu, %lu}, ru_stime={%lu, %lu}, ",
			(long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec,
			(long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec);
		tprintf("ru_maxrss=%lu, ru_ixrss=%lu, ",
			ru.ru_maxrss, ru.ru_ixrss);
		tprintf("ru_idrss=%lu, ru_isrss=%lu, ",
			ru.ru_idrss, ru.ru_isrss);
		tprintf("ru_minflt=%lu, ru_majflt=%lu, ru_nswap=%lu, ",
			ru.ru_minflt, ru.ru_majflt, ru.ru_nswap);
		tprintf("ru_inblock=%lu, ru_oublock=%lu, ",
			ru.ru_inblock, ru.ru_oublock);
		tprintf("ru_msgsnd=%lu, ru_msgrcv=%lu, ",
			ru.ru_msgsnd, ru.ru_msgrcv);
		tprintf("ru_nsignals=%lu, ru_nvcsw=%lu, ru_nivcsw=%lu}",
			ru.ru_nsignals, ru.ru_nvcsw, ru.ru_nivcsw);
	}
	else {
		tprintf("{ru_utime={%lu, %lu}, ru_stime={%lu, %lu}, ...}",
			(long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec,
			(long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec);
	}
}
Ejemplo n.º 18
0
void OneshotTracer::tick(std::map<pid_t, std::vector<Frame>> stacktraces) {
    for (const auto& kv: stacktraces) {
        std::cout << boost::format("Thread %d:\n") % kv.first;
        for (const auto& frame: kv.second) {
            std::cout << str(boost::format("0x%x %s\n") %
                        frame.ip %
                        abbrev(demangle(frame.procName)));
        }
        std::cout << std::endl;
    }
}
Ejemplo n.º 19
0
msg(source, mc, data, mapping vars) {
	if (abbrev("_notice_email_delivered", mc)) {
		// eine _notice_email_delivered wird im server-fenster angezeigt, nicht im raum..
		// naja, der raum ist eh nicht zum chatten da..
		// net/irc sollte das problem geschickter lösen dann..
		// und nicht hier sowas komisches da:
		castmsg(source, "_message_public_mail",
			vars["_subject"]+":\n"+vars["_content"],
			vars);
		if (sizeof(mails) >= _limit_amount_history_mailcast) {
			mails[0] = 0;
			mails -= ({ 0 });
Ejemplo n.º 20
0
static void
print_rtc_time(struct tcb *tcp, const struct rtc_time *rt)
{
	tprintf("{tm_sec=%d, tm_min=%d, tm_hour=%d, "
		"tm_mday=%d, tm_mon=%d, tm_year=%d, ",
		rt->tm_sec, rt->tm_min, rt->tm_hour,
		rt->tm_mday, rt->tm_mon, rt->tm_year);
	if (!abbrev(tcp))
		tprintf("tm_wday=%d, tm_yday=%d, tm_isdst=%d}",
			rt->tm_wday, rt->tm_yday, rt->tm_isdst);
	else
		tprints("...}");
}
Ejemplo n.º 21
0
Archivo: user.c Proyecto: Artea/psyced
msg(source, mc, data, mapping vars, showingLog) {
    int ret;
    string jid, buddy;
    string packet;
    mixed t;

    P2(("%s beim jabber:user:msg\n", mc))
    // net/group/master says we should copy vars if we need to
    // mess with it. yes we certainly do! major bugfix here :)
    vars = copy(vars);

    // looks quite similar to the stuff in active.c, but active
    // is much more elaborated
    if (vars["_place"]) vars["_place"] = mkjid(vars["_place"]);

    if (abbrev("_message_echo_public", mc) || abbrev("_jabber", mc)) {
        return render(mc, data, vars, source);
    } else if (abbrev("_message_echo_private", mc) && v("echo") != "on") {
        return;
    } else if (abbrev("_notice_place_enter", mc)) {
        mc = "_notice_place_enter";
        vars["_source_relay"] = mkjid(source);
    } else if (abbrev("_echo_place_enter", mc)) {
#if 1
        // we need ::msg to do the check only - this is a dirty hack
        // see ::msg _echo_place_enter comment on enterMembers
        if (::msg(source, "_echo_place_enter_INTERNAL_CHECK", data, vars, showingLog) == -1)
            return;
        // there probably is a nicer way to do this, but for now this will do
#endif
#if 0
        affiliations[source] = vars["_duty"];
        mc = "_echo_place_enter";
        vars["_source_relay"] = myjid;
#else
# ifdef ENTER_MEMBERS
        string template;
Ejemplo n.º 22
0
static void
have_letter(void)
{
  char buff[MAX_LENGTH];
  int count;

  count = 0;
  buff[count++] = ' ';		/* Required initial blank */

  buff[count++] = makeupper(Char);

  for (new_char() ; 
       isalpha(Char) || Char == '\'' || Char == '_'; 
       new_char())
    {
      buff[count++] = makeupper(Char);
      if (count > MAX_LENGTH-2)
	{
	  buff[count++] = ' ';
	  buff[count++] = '\0';
	  dmk_word(buff);
	  count = 1;
	}
    }

  buff[count++] = ' ';		/* Required terminating blank */
  buff[count++] = '\0';

  /* Check for AAANNN type abbreviations */
  if (isdigit(Char))
    {
      dmk_spell_word(buff);
      return;
    }
  else
    if (strlen(buff) == 3)	/* one character, two spaces */
      dmk_say_ascii(buff[1]);
    else
      if (Char == '.')		/* Possible abbreviation */
	abbrev(buff);
      else
	dmk_word(buff);

  if (Char == '-' && isalpha(Char1))
    new_char();			/* Skip hyphens */

}
Ejemplo n.º 23
0
int valid_exec(string name, object ob, object obfrom) {
//  switch(name) {
//    case "secure/login.c":
//    case "obj/master.c":
#ifdef SANDBOX // sucks here. i'd love to use uids, but we get a $%!!"
	       // program name string
#ifndef __COMPAT_MODE__
	if (name[0] == '/') name = name[1..];
#endif
	if (abbrev(name, "users/")) return 0;
#endif
	if (!interactive(ob)) {
	    return 1;
        }
//  }
    return 0;
}
Ejemplo n.º 24
0
int
sys_subpage_prot(struct tcb *tcp)
{
	if (entering(tcp)) {
		unsigned long cur, end, abbrev_end, entries;
		unsigned int entry;

		tprintf("%#lx, %#lx, ", tcp->u_arg[0], tcp->u_arg[1]);
		entries = tcp->u_arg[1] >> 16;
		if (!entries || !tcp->u_arg[2]) {
			tprints("{}");
			return 0;
		}
		cur = tcp->u_arg[2];
		end = cur + (sizeof(int) * entries);
		if (!verbose(tcp) || end < tcp->u_arg[2]) {
			tprintf("%#lx", tcp->u_arg[2]);
			return 0;
		}
		if (abbrev(tcp)) {
			abbrev_end = cur + (sizeof(int) * max_strlen);
			if (abbrev_end > end)
				abbrev_end = end;
		}
		else
			abbrev_end = end;
		tprints("{");
		for (; cur < end; cur += sizeof(int)) {
			if (cur > tcp->u_arg[2])
				tprints(", ");
			if (cur >= abbrev_end) {
				tprints("...");
				break;
			}
			if (umove(tcp, cur, &entry) < 0) {
				tprintf("??? [%#lx]", cur);
				break;
			}
			else
				tprintf("%#08x", entry);
		}
		tprints("}");
	}

	return 0;
}
Ejemplo n.º 25
0
static void
print_cmsg_ip_opts(struct tcb *tcp, const void *cmsg_data,
		   const size_t data_len)
{
	const unsigned char *opts = cmsg_data;
	size_t i;

	tprints("[");
	for (i = 0; i < data_len; ++i) {
		if (i)
			tprints(", ");
		if (abbrev(tcp) && i >= max_strlen) {
			tprints("...");
			break;
		}
		tprintf("0x%02x", opts[i]);
	}
	tprints("]");
}
Ejemplo n.º 26
0
static void
get_nodes(struct tcb *tcp, unsigned long ptr, unsigned long maxnodes, int err)
{
	unsigned long nlongs, size, end;

	nlongs = (maxnodes + 8 * sizeof(long) - 1) / (8 * sizeof(long));
	size = nlongs * sizeof(long);
	end = ptr + size;
	if (nlongs == 0 || ((err || verbose(tcp)) && (size * 8 == maxnodes)
			    && (end > ptr))) {
		unsigned long n, cur, abbrev_end;
		int failed = 0;

		if (abbrev(tcp)) {
			abbrev_end = ptr + max_strlen * sizeof(long);
			if (abbrev_end < ptr)
				abbrev_end = end;
		} else {
			abbrev_end = end;
		}
		tprints(", {");
		for (cur = ptr; cur < end; cur += sizeof(long)) {
			if (cur > ptr)
				tprints(", ");
			if (cur >= abbrev_end) {
				tprints("...");
				break;
			}
			if (umoven(tcp, cur, sizeof(n), (char *) &n) < 0) {
				tprints("?");
				failed = 1;
				break;
			}
			tprintf("%#0*lx", (int) sizeof(long) * 2 + 2, n);
		}
		tprints("}");
		if (failed)
			tprintf(" %#lx", ptr);
	} else
		tprintf(", %#lx", ptr);
	tprintf(", %lu", maxnodes);
}
Ejemplo n.º 27
0
static int
decode_bitset(struct tcb *const tcp, const kernel_ulong_t arg,
	      const struct xlat decode_nr[], const unsigned int max_nr,
	      const char *const dflt)
{
	tprints(", ");

	unsigned int size;
	if ((kernel_ulong_t) tcp->u_rval > max_nr)
		size = max_nr;
	else
		size = tcp->u_rval;
	char decoded_arg[size];

	if (umove_or_printaddr(tcp, arg, &decoded_arg))
		return 1;

	tprints("[");

	int bit_displayed = 0;
	int i = next_set_bit(decoded_arg, 0, size);
	if (i < 0) {
		tprints(" 0 ");
	} else {
		printxval(decode_nr, i, dflt);

		while ((i = next_set_bit(decoded_arg, i + 1, size)) > 0) {
			if (abbrev(tcp) && bit_displayed >= 3) {
				tprints(", ...");
				break;
			}
			tprints(", ");
			printxval(decode_nr, i, dflt);
			bit_displayed++;
		}
	}

	tprints("]");

	return 1;
}
Ejemplo n.º 28
0
static void
tprint_sembuf(struct tcb *tcp, long addr, unsigned long count)
{
	unsigned long i, max_count;

	if (abbrev(tcp))
		max_count = (max_strlen < count) ? max_strlen : count;
	else
		max_count = count;

	if (!max_count) {
		tprintf("%#lx, %lu", addr, count);
		return;
	}

	for (i = 0; i < max_count; ++i) {
		struct sembuf sb;
		if (i)
			tprints(", ");
		if (umove(tcp, addr + i * sizeof(struct sembuf), &sb) < 0) {
			if (i) {
				tprints("{???}");
				break;
			} else {
				tprintf("%#lx, %lu", addr, count);
				return;
			}
		} else {
			if (!i)
				tprints("{");
			tprintf("{%u, %d, ", sb.sem_num, sb.sem_op);
			printflags(semop_flags, sb.sem_flg, "SEM_???");
			tprints("}");
		}
	}

	if (i < max_count || max_count < count)
		tprints(", ...");

	tprintf("}, %lu", count);
}
Ejemplo n.º 29
0
static void
print_scm_rights(struct tcb *tcp, const void *cmsg_data, const size_t data_len)
{
	const int *fds = cmsg_data;
	const size_t nfds = data_len / sizeof(*fds);
	size_t i;

	tprints("[");

	for (i = 0; i < nfds; ++i) {
		if (i)
			tprints(", ");
		if (abbrev(tcp) && i >= max_strlen) {
			tprints("...");
			break;
		}
		printfd(tcp, fds[i]);
	}

	tprints("]");
}
Ejemplo n.º 30
0
static void
decode_termio(struct tcb *const tcp, const kernel_ulong_t addr)
{
	struct termio tio;
	int i;

	tprints(", ");
	if (umove_or_printaddr(tcp, addr, &tio))
		return;
	if (abbrev(tcp)) {
		tprints("{");
		printxval(baud_options, tio.c_cflag & CBAUD, "B???");
		tprintf(" %sopost %sisig %sicanon %secho ...}",
			(tio.c_oflag & OPOST) ? "" : "-",
			(tio.c_lflag & ISIG) ? "" : "-",
			(tio.c_lflag & ICANON) ? "" : "-",
			(tio.c_lflag & ECHO) ? "" : "-");
		return;
	}
	tprintf("{c_iflags=%#lx, c_oflags=%#lx, ",
		(long) tio.c_iflag, (long) tio.c_oflag);
	tprintf("c_cflags=%#lx, c_lflags=%#lx, ",
		(long) tio.c_cflag, (long) tio.c_lflag);
	tprintf("c_line=%u, ", tio.c_line);
#ifdef _VMIN
	if (!(tio.c_lflag & ICANON))
		tprintf("c_cc[_VMIN]=%d, c_cc[_VTIME]=%d, ",
			tio.c_cc[_VMIN], tio.c_cc[_VTIME]);
#else /* !_VMIN */
	if (!(tio.c_lflag & ICANON))
		tprintf("c_cc[VMIN]=%d, c_cc[VTIME]=%d, ",
			tio.c_cc[VMIN], tio.c_cc[VTIME]);
#endif /* !_VMIN */
	tprints("c_cc=\"");
	for (i = 0; i < NCC; i++)
		tprintf("\\x%02x", tio.c_cc[i]);
	tprints("\"}");
}