• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_user函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中set_user函数的典型用法代码示例。如果您正苦于以下问题:C++ set_user函数的具体用法?C++ set_user怎么用?C++ set_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了set_user函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: detected

void detected(int code, const char *msg)
{
  char tmp[512] = "";
  struct flag_record fr = { FR_GLOBAL, 0, 0, 0 };
  int act = DET_WARN, do_fatal = 0, killbots = 0;
  
  if (code == DETECT_LOGIN)
    act = login;
  if (code == DETECT_TRACE)
    act = trace;
  if (code == DETECT_PROMISC)
    act = promisc;
#ifdef NOT_USED
  if (code == DETECT_PROCESS)
    act = badprocess;
#endif
  if (code == DETECT_HIJACK)
    act = hijack;

  switch (act) {
  case DET_IGNORE:
    break;
  case DET_WARN:
    putlog(LOG_WARN, "*", msg);
    break;
  case DET_REJECT:
    do_fork();
    putlog(LOG_WARN, "*", STR("Setting myself +d: %s"), msg);
    simple_snprintf(tmp, sizeof(tmp), "+d: %s", msg);
    set_user(&USERENTRY_COMMENT, conf.bot->u, tmp);
    fr.global = USER_DEOP;
    fr.bot = 1;
    set_user_flagrec(conf.bot->u, &fr, 0);
    sleep(1);
    break;
  case DET_DIE:
    putlog(LOG_WARN, "*", STR("Dying: %s"), msg);
    simple_snprintf(tmp, sizeof(tmp), STR("Dying: %s"), msg);
    set_user(&USERENTRY_COMMENT, conf.bot->u, tmp);
    if (!conf.bot->hub)
      nuke_server(STR("BBL"));
    sleep(1);
    killbots++;
    do_fatal++;
    break;
  case DET_SUICIDE:
    suicide(msg);
    break;
  }
  if (killbots && conf.bot->localhub) {
    conf_checkpids(conf.bots);
    conf_killbot(conf.bots, NULL, NULL, SIGKILL);
  }
  if (do_fatal)
    fatal(msg, 0);
}
开发者ID:Estella,项目名称:wraith,代码行数:56,代码来源:shell.c


示例2: chanprog

void chanprog()
{
  struct utsname un;


  sdprintf("I am: %s", conf.bot->nick);

  /* Add the 'default' virtual channel.
     The flags will be overwritten when the userfile is loaded,
     but if there is no userfile yet, or no 'default' channel,
     then it will take on the properties of 'def_chanset',
     and then later save this to the userfile.
   */
  channel_add(NULL, "default", def_chanset, 1);

  if (conf.bot->hub) {
    simple_snprintf(userfile, 121, "%s/.u", dirname(binname));
    loading = 1;
    checkchans(0);
    readuserfile(userfile, &userlist);
    checkchans(1);
    var_parse_my_botset();
    loading = 0;
  }

  load_internal_users();

  add_myself_to_userlist();

  if (conf.bot->localhub)
    add_child_bots();
  else if (!conf.bot->hub)
    add_localhub();

  rehash_ip();

  /* set our shell info */
  uname(&un);
  set_user(&USERENTRY_OS, conf.bot->u, un.sysname);
  set_user(&USERENTRY_USERNAME, conf.bot->u, conf.username);
  set_user(&USERENTRY_NODENAME, conf.bot->u, un.nodename);
  set_user(&USERENTRY_ARCH, conf.bot->u, un.machine);
  set_user(&USERENTRY_OSVER, conf.bot->u, un.release);

  var_parse_my_botset();

  /* We should be safe now */

  reaffirm_owners();
}
开发者ID:x90,项目名称:wraith,代码行数:50,代码来源:chanprog.c


示例3: pass_set

static bool pass_set(struct userrec *u, struct user_entry *e, void *buf)
{
  char *newpass = NULL;
  register char *pass = (char *) buf;

  if (e->u.extra)
    free(e->u.extra);
  if (!pass || !pass[0] || (pass[0] == '-'))
    e->u.extra = NULL;
  else {
    unsigned char *p = (unsigned char *) pass;

    if (u->bot || (pass[0] == '+'))
      newpass = strdup(pass);
    else {
      while (*p) {
        if ((*p <= 32) || (*p == 127))
          *p = '?';
        p++;
      }
      newpass = salted_sha1(pass);
    }
    e->u.extra = strdup(newpass);
  }
  if (!noshare)
    shareout("c %s %s %s\n", e->type->name, u->handle, newpass ? newpass : "");
  if (newpass)
    free(newpass);

  /* clear old records */
  noshare = 1;
  set_user(&USERENTRY_PASS1, u, NULL);
  noshare = 0;
  return 1;
}
开发者ID:Mafaioz,项目名称:wraith,代码行数:35,代码来源:userent.c


示例4: sys_setuid

/*
 * setuid() is implemented like SysV with SAVED_IDS 
 * 
 * Note that SAVED_ID's is deficient in that a setuid root program
 * like sendmail, for example, cannot set its uid to be a normal 
 * user and then switch back, because if you're root, setuid() sets
 * the saved uid too.  If you don't like this, blame the bright people
 * in the POSIX committee and/or USG.  Note that the BSD-style setreuid()
 * will allow a root program to temporarily drop privileges and be able to
 * regain them by swapping the real and effective uid.  
 */
asmlinkage long sys_setuid(uid_t uid)
{
	int old_euid = current->euid;
	int old_ruid, old_suid, new_ruid, new_suid;
	int retval;

	retval = security_task_setuid(uid, (uid_t)-1, (uid_t)-1, LSM_SETID_ID);
	if (retval)
		return retval;

	old_ruid = new_ruid = current->uid;
	old_suid = current->suid;
	new_suid = old_suid;
	
	if (capable(CAP_SETUID)) {
		if (uid != old_ruid && set_user(uid, old_euid != uid) < 0)
			return -EAGAIN;
		new_suid = uid;
	} else if ((uid != current->uid) && (uid != new_suid))
		return -EPERM;

	if (old_euid != uid)
	{
		current->mm->dumpable = 0;
		wmb();
	}
	current->fsuid = current->euid = uid;
	current->suid = new_suid;

	return security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_ID);
}
开发者ID:xricson,项目名称:knoppix,代码行数:42,代码来源:sys.c


示例5: update_mod

void update_mod(char *handle, char *nick, char *cmd, char *par)
{
  char tmp[100] = "";

  simple_snprintf(tmp, sizeof tmp, "%li, %s (%s %s)", (long) now, nick, cmd, (par && par[0]) ? par : "");
  set_user(&USERENTRY_MODIFIED, get_user_by_handle(userlist, handle), tmp);
}
开发者ID:Mafaioz,项目名称:wraith,代码行数:7,代码来源:userent.c


示例6: write_key_file

/*%
 * Write a key file to 'keyfile'.  If 'user' is non-NULL,
 * make that user the owner of the file.  The key will have
 * the name 'keyname' and the secret in the buffer 'secret'.
 */
void
write_key_file(const char *keyfile, const char *user,
	       const char *keyname, isc_buffer_t *secret,
	       dns_secalg_t alg) {
	isc_result_t result;
	const char *algname = alg_totext(alg);
	FILE *fd = NULL;

	DO("create keyfile", isc_file_safecreate(keyfile, &fd));

	if (user != NULL) {
		if (set_user(fd, user) == -1)
			fatal("unable to set file owner\n");
	}

	fprintf(fd, "key \"%s\" {\n\talgorithm %s;\n"
		"\tsecret \"%.*s\";\n};\n",
		keyname, algname,
		(int)isc_buffer_usedlength(secret),
		(char *)isc_buffer_base(secret));
	fflush(fd);
	if (ferror(fd))
		fatal("write to %s failed\n", keyfile);
	if (fclose(fd))
		fatal("fclose(%s) failed\n", keyfile);
	fprintf(stderr, "wrote key file \"%s\"\n", keyfile);
}
开发者ID:crossbuild,项目名称:bind,代码行数:32,代码来源:keygen.c


示例7: sys_setuid

/*
 * setuid() is implemented like SysV with SAVED_IDS 
 * 
 * Note that SAVED_ID's is deficient in that a setuid root program
 * like sendmail, for example, cannot set its uid to be a normal 
 * user and then switch back, because if you're root, setuid() sets
 * the saved uid too.  If you don't like this, blame the bright people
 * in the POSIX committee and/or USG.  Note that the BSD-style setreuid()
 * will allow a root program to temporarily drop privileges and be able to
 * regain them by swapping the real and effective uid.  
 */
asmlinkage long sys_setuid(uid_t uid)
{
	int old_euid = current->euid;
	int old_ruid, old_suid, new_suid;
	int retval;

	retval = security_task_setuid(uid, (uid_t)-1, (uid_t)-1, LSM_SETID_ID);
	if (retval)
		return retval;

	old_ruid = current->uid;
	old_suid = current->suid;
	new_suid = old_suid;
	
	if (capable(CAP_SETUID)) {
		if (uid != old_ruid && set_user(uid, old_euid != uid) < 0)
			return -EAGAIN;
		new_suid = uid;
	} else if ((uid != current->uid) && (uid != new_suid))
		return -EPERM;

	if (old_euid != uid) {
		set_dumpable(current->mm, suid_dumpable);
		smp_wmb();
	}
	current->fsuid = current->euid = uid;
	current->suid = new_suid;

	key_fsuid_changed(current);
	proc_id_connector(current, PROC_EVENT_UID);

	return security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_ID);
}
开发者ID:maraz,项目名称:linux-2.6,代码行数:44,代码来源:sys.c


示例8: main

	void main(){
		int i;
		int read;

		while(1){
			data_sum=save_sum=0;
			printf("使用するユーザ名を入力して下さい\n");
			scanf("%s",login_user);

			set_user();
			set_cate();
			if(set_data(login_user)==-1)printf("データがありません\n");
			else{
				printf("%sさんのデータ\n",login_user);
				for(i=0;i<data_sum;i++){
					printf("%d/%d/%d ",data[i].year,data[i].month,data[i].day);
					printf("%s ",data[i].item);
					printf("%d ",data[i].cate);
					printf("%8d ",data[i].value);
					printf("%d\n",data[i].inout);
				}
				save_dat();
			}
			printf("\n続行-->1 終了-->2\n");
			scanf("%d",&read);
			if(read==2)break;
		}
	}
开发者ID:BlaMilk,项目名称:HAB,代码行数:28,代码来源:FileInputOutput.c


示例9: console_store

static int
console_store(int idx, char *par, bool displaySave)
{
  struct console_info *i = (struct console_info *) get_user(&USERENTRY_CONSOLE, dcc[idx].user);

  if (!i) 
    i = (struct console_info *) my_calloc(1, sizeof(struct console_info));
  
  if (i->channel)
    free(i->channel);
  i->channel = strdup(dcc[idx].u.chat->con_chan);
  i->conflags = dcc[idx].u.chat->con_flags;
  i->stripflags = dcc[idx].u.chat->strip_flags;
  i->echoflags = (dcc[idx].status & STAT_ECHO) ? 1 : 0;
  if (dcc[idx].status & STAT_PAGE)
    i->page = dcc[idx].u.chat->max_line;
  else
    i->page = 0;
  if (dcc[idx].status & STAT_COLOR)
    i->color = 1;
  else
    i->color = 0;
  if (dcc[idx].status & STAT_BANNER)
    i->banner = 1;
  else
    i->banner = 0;
  if (dcc[idx].status & STAT_CHANNELS)
    i->channels = 1;
  else
    i->channels = 0;
  if (dcc[idx].status & STAT_BOTS)
    i->bots = 1;
  else
    i->bots = 0;
  if (dcc[idx].status & STAT_WHOM)
    i->whom = 1;
  else
    i->whom = 0;

  i->conchan = dcc[idx].u.chat->channel;
  if (par) {
    dprintf(idx, "%s\n", "Saved your Console Settings:");
    dprintf(idx, "  %s %s\n", "Channel:", i->channel);
    dprintf(idx, "  %s %s, %s %s, %s %s\n", "Console flags:",
            masktype(i->conflags), "",
            stripmasktype(i->stripflags), "Echo:", i->echoflags ? "yes" : "no");
    dprintf(idx, "  %s %d, %s %d\n", "Page setting:", i->page, "Console channel:", i->conchan);
    dprintf(idx, "    Color: $b%s$b\n", i->color ? "on" : "off");
    dprintf(idx, "    Login settings:\n");
    dprintf(idx, "    Login settings:\n");
    dprintf(idx, "     Banner:   $b%-3s$b   Bots: $b%-3s$b\n", i->banner ? "on" : "off", i->bots ? "on" : "off");
    dprintf(idx, "     Channels: $b%-3s$b   Whom: $b%-3s$b\n", i->channels ? "on" : "off", i->whom ? "on" : "off");

  }
  set_user(&USERENTRY_CONSOLE, dcc[idx].user, i);
  dprintf(idx, "Console setting stored.\n");
  if (conf.bot->hub)
    write_userfile(displaySave ? idx : -1);
  return 0;
}
开发者ID:Estella,项目名称:wraith,代码行数:60,代码来源:console.c


示例10: stats_add

void stats_add(struct userrec *u, int islogin, int op)
{
  if (!u || u->bot)
    return;

  char *s = (char *) get_user(&USERENTRY_STATS, u), s2[50] = "";
  int sl, so;

  if (s) {
    strlcpy(s2, s, sizeof(s2));
  } else
    strlcpy(s2, "0 0", sizeof(s2));
  s = strchr(s2, ' ');
  if (s) {
    s++;
    so = atoi(s);
  } else
    so = 0;
  sl = atoi(s2);
  if (islogin)
    sl++;
  if (op)
    so++;
  simple_snprintf(s2, sizeof(s2), "%i %i", sl, so);
  set_user(&USERENTRY_STATS, u, s2);
}
开发者ID:Mafaioz,项目名称:wraith,代码行数:26,代码来源:userent.c


示例11: hippo_block_blog_person_update_from_xml

static gboolean
hippo_block_blog_person_update_from_xml (HippoBlock           *block,
                                         HippoDataCache       *cache,
                                         LmMessageNode        *node)
{
    HippoBlockBlogPerson *block_blog_person = HIPPO_BLOCK_BLOG_PERSON(block);
    LmMessageNode *blog_node;
    HippoPerson *user;

    if (!HIPPO_BLOCK_CLASS(hippo_block_blog_person_parent_class)->update_from_xml(block, cache, node))
        return FALSE;

#if 0
    if (!hippo_xml_split(cache, node, NULL,
                         "blogPerson", HIPPO_SPLIT_NODE, &blog_node,
                         NULL))
        return FALSE;

    if (!hippo_xml_split(cache, blog_node, NULL,
                         "userId", HIPPO_SPLIT_PERSON, &user,
                         NULL))
        return FALSE;
    
    set_user(block_blog_person, user);
#endif
    
    return TRUE;
}
开发者ID:nihed,项目名称:magnetism,代码行数:28,代码来源:hippo-block-blog-person.c


示例12: main

int main(int argc, char *argv[]) {

	Irc freenode;
	struct pollfd pfd[4];
	int i, ready, murm_listenfd = -1;

	initialize(argc, argv);

	for (i = 0; i < SIZE(pfd); i++) {
		pfd[i].fd = -1;
		pfd[i].events = POLLIN;
	}
	if (add_murmur_callbacks(cfg.murmur_port))
		pfd[MURM_LISTEN].fd = murm_listenfd = sock_listen(LOCALHOST, CB_LISTEN_PORT_S);
	else
		fprintf(stderr, "Could not connect to Murmur\n");

	if ((pfd[MPD].fd = mpdfd = mpd_connect(cfg.mpd_port)) < 0)
		fprintf(stderr, "Could not connect to MPD\n");

	// Connect to server and set IRC details
	if (!(freenode = irc_connect(cfg.server, cfg.port)))
		exit_msg("Irc connection failed");

	pfd[IRC].fd = get_socket(freenode);
	set_nick(freenode, cfg.nick);
	set_user(freenode, cfg.user);
	for (i = 0; i < cfg.channels_set; i++)
		join_channel(freenode, cfg.channels[i]);

	while ((ready = poll(pfd, SIZE(pfd), TIMEOUT)) > 0) {
		// Keep reading & parsing lines as long the connection is active and act on any registered actions found
		if (pfd[IRC].revents & POLLIN)
			while (parse_irc_line(freenode) > 0);

		if (pfd[MURM_LISTEN].revents & POLLIN)
			if ((pfd[MURM_ACCEPT].fd = accept_murmur_connection(murm_listenfd)) > 0)
				pfd[MURM_LISTEN].fd = -1; // Stop listening for connections

		if (pfd[MURM_ACCEPT].revents & POLLIN) {
			if (!listen_murmur_callbacks(freenode, pfd[MURM_ACCEPT].fd)) {
				pfd[MURM_ACCEPT].fd = -1;
				pfd[MURM_LISTEN].fd = murm_listenfd; // Start listening again for Murmur connections
			}
		}
		if (pfd[MPD].revents & POLLIN)
			if (!print_song(freenode, default_channel(freenode)))
				pfd[MPD].fd = mpdfd = mpd_connect(cfg.mpd_port);
	}
	// If we reach here, it means we got disconnected from server. Exit with error (1)
	if (ready == -1)
		perror("poll");
	else
		fprintf(stderr, "%d minutes passed without getting a message, exiting...\n", TIMEOUT / 1000 / 60);

	quit_server(freenode, cfg.quit_msg);
	cleanup();
	return 1;
}
开发者ID:charkost,项目名称:irc-bot,代码行数:59,代码来源:main.c


示例13: bot_handshake

static void bot_handshake(int idx, char *par)
{
  struct userrec *u = get_user_by_handle(userlist, dcc[idx].nick);

  /* We *don't* want botnet passwords migrating */
  noshare = 1;
  set_user(&USERENTRY_PASS, u, par);
  noshare = 0;
}
开发者ID:Estella,项目名称:eggdrop-1.7,代码行数:9,代码来源:botcmd.c


示例14: hippo_block_abstract_person_dispose

static void
hippo_block_abstract_person_dispose(GObject *object)
{
    HippoBlockAbstractPerson *block_abstract_person = HIPPO_BLOCK_ABSTRACT_PERSON(object);

    set_user(block_abstract_person, NULL);

    G_OBJECT_CLASS(hippo_block_abstract_person_parent_class)->dispose(object);
}
开发者ID:nihed,项目名称:magnetism,代码行数:9,代码来源:hippo-block-abstract-person.c


示例15: bot_shellinfo

static void bot_shellinfo(int idx, char *par)
{
  char *username = NULL, *sysname = NULL, *nodename = NULL, *arch = NULL, *botversion = NULL;
  
  username = newsplit(&par);
  sysname = newsplit(&par);
  nodename = newsplit(&par);
  arch = newsplit(&par);
  botversion = newsplit(&par);

  set_user(&USERENTRY_USERNAME, dcc[idx].user, username);
  set_user(&USERENTRY_OS, dcc[idx].user, sysname);
  dcc[idx].u.bot->sysname[0] = 0;
  struct bot_info dummy;
  strlcpy(dcc[idx].u.bot->sysname, sysname, sizeof(dummy.sysname)); 
  set_user(&USERENTRY_NODENAME, dcc[idx].user, nodename);
  set_user(&USERENTRY_ARCH, dcc[idx].user, arch);
  set_user(&USERENTRY_OSVER, dcc[idx].user, botversion);
}
开发者ID:vap0r,项目名称:wraith,代码行数:19,代码来源:botcmd.c


示例16: dcc_files

static void dcc_files(int idx, char *buf, int i)
{
  Context;
  if (buf[0] &&
      detect_dcc_flood(&dcc[idx].timeval, dcc[idx].u.file->chat, idx))
    return;
  dcc[idx].timeval = now;
  strcpy(buf, check_tcl_filt(idx, buf));
  if (!buf[0])
    return;
  touch_laston(dcc[idx].user, "filearea", now);
  if (buf[0] == ',') {
    for (i = 0; i < dcc_total; i++) {
      if ((dcc[i].type->flags & DCT_MASTER) && dcc[idx].user &&
	  (dcc[idx].user->flags & USER_MASTER) &&
	  ((dcc[i].type == &DCC_FILES) ||
	   (dcc[i].u.chat->channel >= 0)) &&
	  ((i != idx) || (dcc[idx].status & STAT_ECHO)))
	dprintf(i, "-%s- %s\n", dcc[idx].nick, &buf[1]);
    }
  } else if (got_files_cmd(idx, buf)) {
    dprintf(idx, "*** Ja mata!\n");
    flush_lines(idx, dcc[idx].u.file->chat);
    putlog(LOG_FILES, "*", "DCC user [%s]%s left file system", dcc[idx].nick,
	   dcc[idx].host);
    set_user(&USERENTRY_DCCDIR, dcc[idx].user, dcc[idx].u.file->dir);
    if (dcc[idx].status & STAT_CHAT) {
      struct chat_info *ci;

      dprintf(idx, "Returning you to command mode...\n");
      ci = dcc[idx].u.file->chat;
      nfree(dcc[idx].u.file);
      dcc[idx].u.chat = ci;
      dcc[idx].status &= (~STAT_CHAT);
      dcc[idx].type = &DCC_CHAT;
      if (dcc[idx].u.chat->channel >= 0) {
	chanout_but(-1, dcc[idx].u.chat->channel,
		    "*** %s has returned.\n", dcc[idx].nick);
	if (dcc[idx].u.chat->channel < 100000)
	  botnet_send_join_idx(idx, -1);
      }
    } else {
      dprintf(idx, "Dropping connection now.\n");
      putlog(LOG_FILES, "*", "Left files: [%s]%s/%d", dcc[idx].nick,
	     dcc[idx].host, dcc[idx].port);
      killsock(dcc[idx].sock);
      lostdcc(idx);
    }
  }
  if (dcc[idx].status & STAT_PAGE)
    flush_lines(idx, dcc[idx].u.file->chat);
}
开发者ID:Estella,项目名称:eggdrop-1.4,代码行数:52,代码来源:filesys.c


示例17: main

int main(int argc, char *argv[])
{
  parse_args(argc, argv);
#ifdef CAPS_SUPPORT
  set_user();
  set_caps();
#endif
  create_thread();
  create_jvm();
  install_sighandler();
  run();
  return 0;
}
开发者ID:bmellstrom,项目名称:semeru,代码行数:13,代码来源:semeru.c


示例18: sys_setreuid

/*
 * Unprivileged users may change the real uid to the effective uid
 * or vice versa.  (BSD-style)
 *
 * If you set the real uid at all, or set the effective uid to a value not
 * equal to the real uid, then the saved uid is set to the new effective uid.
 *
 * This makes it possible for a setuid program to completely drop its
 * privileges, which is often a useful assertion to make when you are doing
 * a security audit over a program.
 *
 * The general idea is that a program which uses just setreuid() will be
 * 100% compatible with BSD.  A program which uses just setuid() will be
 * 100% compatible with POSIX with saved IDs.
 */
asmlinkage long sys_setreuid(uid_t ruid, uid_t euid)
{
    int old_ruid, old_euid, old_suid, new_ruid, new_euid;
    int retval;

    retval = security_task_setuid(ruid, euid, (uid_t)-1, LSM_SETID_RE);
    if (retval)
        return retval;

    new_ruid = old_ruid = current->uid;
    new_euid = old_euid = current->euid;
    old_suid = current->suid;

    if (ruid != (uid_t) -1) {
        new_ruid = ruid;
        if ((old_ruid != ruid) &&
                (current->euid != ruid) &&
                !capable(CAP_SETUID))
            return -EPERM;
    }

    if (euid != (uid_t) -1) {
        new_euid = euid;
        if ((old_ruid != euid) &&
                (current->euid != euid) &&
                (current->suid != euid) &&
                !capable(CAP_SETUID))
            return -EPERM;
    }

    if (new_ruid != old_ruid && set_user(new_ruid, new_euid != old_euid) < 0)
        return -EAGAIN;

    if (new_euid != old_euid)
    {
        current->mm->dumpable = suid_dumpable;
        smp_wmb();
    }
    current->fsuid = current->euid = new_euid;
    if (ruid != (uid_t) -1 ||
            (euid != (uid_t) -1 && euid != old_ruid))
        current->suid = current->euid;
    current->fsuid = current->euid;

    key_fsuid_changed(current);
    proc_id_connector(current, PROC_EVENT_UID);

    return security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_RE);
}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:64,代码来源:sys.c


示例19: set_user_flagrec

void set_user_flagrec(struct userrec *u, struct flag_record *fr,
		      char *chname)
{
  struct chanuserrec *cr = NULL;
  int oldflags = fr->match;
  char buffer[100];
  struct chanset_t *ch;

  if (!u)
    return;
  if (oldflags & FR_GLOBAL) {
    u->flags = fr->global;

    u->flags_udef = fr->udef_global;
    if (!noshare && !(u->flags & USER_UNSHARED)) {
      fr->match = FR_GLOBAL;
      build_flags(buffer, fr, NULL);
      shareout(NULL, "a %s %s\n", u->handle, buffer);
    }
  }
  if ((oldflags & FR_BOT) && (u->flags & USER_BOT))
    set_user(&USERENTRY_BOTFL, u, (void *) fr->bot);
  /* dont share bot attrs */
  if ((oldflags & FR_CHAN) && chname) {
    for (cr = u->chanrec; cr; cr = cr->next)
      if (!rfc_casecmp(chname, cr->channel))
	break;
    ch = findchan(chname);
    if (!cr && ch) {
      cr = user_malloc(sizeof(struct chanuserrec));
      bzero(cr, sizeof(struct chanuserrec));

      cr->next = u->chanrec;
      u->chanrec = cr;
      strncpy(cr->channel, chname, 80);
      cr->channel[80] = 0;
    }
    if (cr && ch) {
      cr->flags = fr->chan;
      cr->flags_udef = fr->udef_chan;
      if (!noshare && !(u->flags & USER_UNSHARED) && channel_shared(ch)) {
	fr->match = FR_CHAN;
	build_flags(buffer, fr, NULL);
	shareout(ch, "a %s %s %s\n", u->handle, buffer, chname);
      }
    }
  }
  fr->match = oldflags;
}
开发者ID:Estella,项目名称:eggdrop-1.4,代码行数:49,代码来源:flags.c


示例20: msg_pass

static int msg_pass(char *nick, char *host, struct userrec *u, char *par)
{
  char *old = NULL, *mynew = NULL;

  if (match_my_nick(nick))
    return BIND_RET_BREAK;
  if (!u) {
    putlog(LOG_CMDS, "*", "(%s!%s) !*! PASS", nick, host);
    return BIND_RET_BREAK;
  }
  if (u->bot)
    return BIND_RET_BREAK;
  if (!par[0]) {
    notice(nick, u_pass_match(u, "-") ? "You don't have a password set." : "You have a password set.", DP_HELP);
    putlog(LOG_CMDS, "*", "(%s!%s) !%s! PASS?", nick, host, u->handle);
    return BIND_RET_BREAK;
  }
  old = newsplit(&par);
  if (!u_pass_match(u, "-") && !par[0]) {
    putlog(LOG_CMDS, "*", "(%s!%s) !%s! $b!$bPASS...", nick, host, u->handle);
    notice(nick, "You already have a password set.", DP_HELP);
    return BIND_RET_BREAK;
  }
  if (par[0]) {
    if (!u_pass_match(u, old)) {
      putlog(LOG_CMDS, "*", "(%s!%s) !%s! $b!$bPASS...", nick, host, u->handle);
      notice(nick, "Incorrect password.", DP_HELP);
      return BIND_RET_BREAK;
    }
    mynew = newsplit(&par);
  } else {
    mynew = old;
  }
  if (strlen(mynew) > MAXPASSLEN)
    mynew[MAXPASSLEN] = 0;

  if (!goodpass(mynew, 0, nick)) {
    putlog(LOG_CMDS, "*", "(%s!%s) !%s! $b!$bPASS...", nick, host, u->handle);
    return BIND_RET_BREAK;
  }

  putlog(LOG_CMDS, "*", "(%s!%s) !%s! PASS", nick, host, u->handle);

  set_user(&USERENTRY_PASS, u, mynew);
  bd::String msg;
  msg = bd::String::printf("%s '%s'.", mynew == old ? "Password set to:" : "Password changed to:", mynew);
  notice(nick, msg.c_str(), DP_HELP);
  return BIND_RET_BREAK;
}
开发者ID:vap0r,项目名称:wraith,代码行数:49,代码来源:msgcmds.c



注:本文中的set_user函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_val函数代码示例发布时间:2022-05-30
下一篇:
C++ set_union函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap