Esempio n. 1
0
void Passwd(){
	char oldpwd[30],newpwd[30],newpwd1[30];
	account_t data=gl_CurUser;
	int i=MAX_TIMES,q=0;
	system("clear");
        printf("\n\t\t==================================================================");
        printf("\n\t\t***************************密码修改********************************");
        printf("\n\t\t==================================================================");
        printf("\n\t\t|	当前用户为:%s",gl_CurUser.username);
       	cl_stdin();      		
       		while(i--){
       	        printf("\n\t\t|	旧密码:");
	       		getpwd(30,oldpwd); //input passwd
	       		
	       		if( strcmp(oldpwd,gl_CurUser.password)==0 ){
	       			q=1;
	       			break;
	       		}else{
	       		
		       		if(i>0){  
					printf("\n\n		------------用户名或密码错误!还可以输入%d次-------------",i);
					sleep(1);
                    }
		        }
            }
		while(q){
				 	printf("\n\t\t|	新密码:");
				//cl_stdin();
				getpwd(30,newpwd);
				 	printf("\n\t\t|	再输一次:");
							
				getpwd(30,newpwd1);
				if( strcmp(newpwd,newpwd1)==0 ){
						strcpy(data.password,newpwd);
						
						if(Account_Srv_Modify(&data)){
							gl_CurUser=data;
							printf("\n		----------------------------修改成功!------------------------------");
			
						}else{

							printf("\n		----------------------------修改失败!------------------------------");
						}
						
						break;
				}else{
							
						printf("\n\n		-----------------两次新密码输入不一致!-------------------------");
					sleep(1);
				}
		}
		
		sleep(1);
	

}
Esempio n. 2
0
void rbenv_initialize_dir() {
  char *pwd = getpwd();

  if (hasenv("RBENV_DIR")) {
    cd_or_exit(getenv("RBENV_DIR"));
    rbenv_dir = getpwd();
    cd_or_exit(pwd);
    free(pwd);
  } else {
    rbenv_dir = pwd;
  }

  setenv("RBENV_DIR", rbenv_dir, 1);
}
Esempio n. 3
0
int SysLogin() {
	
	
	int i=MAX_TIMES;
	char uname[30],pwd[30];
	
	Account_Srv_InitSys();
	
	while(i--){
		system("clear");
        printf("\n\t\t==================================================================");
        printf("\n\t\t***************************用户登陆********************************");
        printf("\n\t\t==================================================================");
        printf("\n\n\n\t\t\t\t用户名:");
       	scanf("%s",&uname);
       	printf("\n\t\t\t\t密  码:");
       	cl_stdin();
       	getpwd(30,pwd); //input passwd	
		if(Account_Srv_Verify(uname,pwd)){ 
			printf("\n\n		------------------------登陆成功!--------------------------");sleep(1);
			return 1;
		}else{

			if(i>0){  
			printf("\n\n		------------用户名或密码错误!还可以输入%d次-------------",i);
				sleep(1);
			}
			   
		}
	}
		return 0;
       		
}
Esempio n. 4
0
void
sfssrp_authorizer::authmore (const sfsagent_authmore_arg *argp,
			     sfsagent_auth_res *resp, cbv cb)
{
  resp->set_authenticate (false);

  sfs_autharg2 aarg (SFS_SRPAUTH);
  aarg.srpauth->req.type = SFS_SIGNED_AUTHREQ;
  aarg.srpauth->req.authid = srpc->sessid;
  aarg.srpauth->req.seqno = argp->seqno;
  aarg.srpauth->req.user = srpc->user;

  switch (srpc->next (&aarg.srpauth->msg, &argp->more)) {
  case SRP_SETPWD:
    if (!argp->checkserver) {
      getpwd (strbuf () << "Passphrase for " << srpc->getname () << ": ",
	      false,
	      wrap (this, &sfssrp_authorizer::authmore_2, argp, resp, cb));
      return;
    }
    break;
  case SRP_NEXT:
    if (!argp->checkserver) 
      setres (resp, aarg);
    break;
  case SRP_DONE:
    if (argp->checkserver)
      resp->set_authenticate (true);
    break;
  default:
    break;
  }
  (*cb) ();
}
Esempio n. 5
0
const char *
get_src_pwd (void)
{
    if (! src_pwd)
        src_pwd = getpwd ();

    return src_pwd;
}
Esempio n. 6
0
int
pwd_main(int argc, char **argv)
{
	char *dir = getpwd();
	
	out1fmt(snlfmt, dir ? dir : "");
	if (dir != NULL)
	{
		free(dir);
	}

	return 0;
}
Esempio n. 7
0
void init(int argc,char ** argv)
{
	port=pwd[0]=notf[0]=0;
	strcpy(pwd,getenv("PWD"));
	if(argv[0][0]!='/')
		sprintf(order,"%s/%s",pwd,argv[0]);
	else sprintf(order,"%s",argv[0]);

	if(argc==1)	{printf("port error\n");exit(0);}
	if(argc>=2)	getport(argv[1]);
	if(argc>=3)	getpwd(argv[2]);
	if(argc>=4)	getnotf(argv[3]);
}
Esempio n. 8
0
void popd(void)
{
    list_t * tail = topd->prev;
    pwd_t *  dir;

    if (list_empty(topd))
	goto out;
    dir = getpwd(tail);
    if (chdir(dir->pwd) < 0)
	error ("popd() can not change directory %s", dir->pwd);
    free(dir->pwd);
    delete(tail);
    free(dir);
out:
    return;
}
Esempio n. 9
0
int
main(int argc, char *argv[])
{
	char *cwd, c;
	char mode = 'L';

	while((c = getopt(argc, argv, "LP")) != -1)
		switch(c) {
		case 'L':
		case 'P':
			mode = c;
			break;
		default:
			exit(EXIT_FAILURE);
		}
	cwd = agetcwd();
	puts((mode == 'L') ? getpwd(cwd) : cwd);
	return EXIT_SUCCESS;
}
Esempio n. 10
0
File: pwd.c Progetto: maandree/sbase
int
main(int argc, char *argv[])
{
	char cwd[PATH_MAX];
	char mode = 'L';

	ARGBEGIN {
	case 'L':
	case 'P':
		mode = ARGC();
		break;
	default:
		usage();
	} ARGEND

	if (!getcwd(cwd, sizeof(cwd)))
		eprintf("getcwd:");
	puts((mode == 'L') ? getpwd(cwd) : cwd);

	return fshut(stdout, "<stdout>");
}
Esempio n. 11
0
//创建系统初始化账号admin
void Account_Srv_InitSys(){
	char entName[8];
	if(Account_Perst_CheckAccFile());
	else
		{
            system("clear");
			account_t data_admin;
			data_admin.id=EntKey_Srv_CompNewKey(entName);//调用函数获取用户id
			printf("\n\n\n\t\t\t\t   \033[31m为您创建系统初始化帐号ADMIN\033[0m");
            printf("\n\n\t\t\t\t请输入姓名:");
            scanf("%s",data_admin.username);//为ata_admin账号赋值成员信息 
			data_admin.type=9;
            cl_stdin();
            printf("\n\t\t\t\t请输入密码:");
			getpwd(30,data_admin.password);
            Account_Srv_Add(&data_admin);//将新建data_admin账号写入文件 
            printf("\n\t\t\t\t\t创建成功!");
            sleep(1);

}
}
Esempio n. 12
0
int main(int ac, char **av)
{
	char dir1[BUFSIZ], dir2[BUFSIZ];
	char cwd1[BUFSIZ], cwd2[BUFSIZ];
	char *pwd1, *pwd2;
	char link2[BUFSIZ];
	int n;
	int lc;			/* loop counter */
	char *msg;		/* parse_opts() return message */

	if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *)NULL) {
		tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
	}

	setup();

	/*
	 * The following loop checks looping state if -i option given
	 */
	for (lc = 0; TEST_LOOPING(lc); lc++) {
		Tst_count = 0;

		flag = 0;

		/*
		 * Create dir1, then chdir to dir1, and get the pwd,
		 * and cwd informations
		 */
		sprintf(dir1, "getcwd1.%d", getpid());
		if (mkdir(dir1, 00755) < 0) {
			tst_brkm(TBROK, cleanup, "mkdir(2) failed");
		 /*NOTREACHED*/}
		if (chdir(dir1) != 0) {
			tst_brkm(TBROK, cleanup, "chdir(2) failed");
		 /*NOTREACHED*/}

		pwd1 = getpwd();
		if (getcwd(cwd1, sizeof cwd1) == NULL) {
			tst_resm(TFAIL, "getcwd() failed unexpectedly: "
				 "errno = %d\n", errno);
			flag = FAILED;
		}
		if ((flag != FAILED) && (strcmp(pwd1, cwd1) != 0)) {
			tst_brkm(TFAIL, cleanup, "getcwd() returned unexpected "
				 "working directory: expected: %s, got: %s\n",
				 pwd1, cwd1);
		 /*NOTREACHED*/}

		tst_resm(TINFO, "getcwd(2) succeeded in returning correct path "
			 "for dir1");

		/*
		 * Now create dir2, then chdir to dir2, and get the pwd,
		 * cwd, and link informations
		 */
		chdir("..");
		flag = 0;

		sprintf(dir2, "getcwd2.%d", getpid());
		if (symlink(dir1, dir2) < 0) {
			tst_brkm(TBROK, cleanup, "symlink(2) failed: errno: %d",
				 errno);
		 /*NOTREACHED*/}

		if (chdir(dir2) != 0) {
			tst_brkm(TBROK, cleanup, "chdir(2) failed: errno: %d",
				 errno);
		 /*NOTREACHED*/}

		pwd2 = getpwd();
		if (getcwd(cwd2, sizeof cwd2) == NULL) {
			tst_resm(TFAIL, "getcwd() failed unexpectedly: "
				 "errno = %d\n", errno);
			flag = FAILED;
		}

		chdir("..");
		if ((flag != FAILED) &&
		    ((n = readlink(dir2, link2, sizeof(link2))) < 0)) {
			tst_brkm(TBROK, cleanup, "readlink(2) failed: errno:%d",
				 errno);
		 /*NOTREACHED*/}

		/*
		 * Finally compare the pwd, cwd, link informations:
		 * The test should pass iff all the following are true:
		 * a.   pwd1 == pwd2
		 * b.   cwd1 == cwd2
		 * c.   link2 == basename(cwd1)
		 */
		if (flag != FAILED) {
			if (strcmp(pwd1, pwd2) != 0) {
				tst_resm(TFAIL, "pwd1: %s, pwd2: %s",
					 pwd1, pwd2);
				flag = FAILED;
			}
			if (strcmp(cwd1, cwd2) != 0) {
				tst_resm(TFAIL, "cwd1: %s, cwd2: %s",
					 cwd1, cwd2);
				flag = FAILED;
			}
			if (memcmp(link2, (char *)basename(cwd1), n) != 0) {
				tst_resm(TFAIL, "link2: %s, cwd1: %s",
					 link2, cwd1);
				flag = FAILED;
			}
			if (flag != FAILED) {
				tst_resm(TINFO, "getcwd(2) succeeded in "
					 "returning correct path for symbolic "
					 "link dir2 -> dir1");
			}
		}

		if (flag == FAILED) {
			tst_resm(TFAIL, "Test FAILED");
		} else {
			tst_resm(TPASS, "Test PASSED");
		}

		/* clean up things in case we are looping */
		if (unlink(dir2) == -1) {
			tst_brkm(TBROK, cleanup, "couldnt remove dir2");
		}
		if (rmdir(dir1) == -1) {
			tst_brkm(TBROK, cleanup, "couldnt remove dir1");
		}
	}
	cleanup();

	 /*NOTREACHED*/ return 0;
}
Esempio n. 13
0
static void
out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg, segT ranges_seg)
{
  char producer[128];
  const char *comp_dir;
  const char *dirname;
  expressionS exp;
  symbolS *info_end;
  char *p;
  int len;
  int sizeof_offset;

  sizeof_offset = out_header (info_seg, &exp);
  info_end = exp.X_add_symbol;

  /* DWARF version.  */
  out_two (DWARF2_VERSION);

  /* .debug_abbrev offset */
  TC_DWARF2_EMIT_OFFSET (section_symbol (abbrev_seg), sizeof_offset);

  /* Target address size.  */
  out_byte (sizeof_address);

  /* DW_TAG_compile_unit DIE abbrev */
  out_uleb128 (1);

  /* DW_AT_stmt_list */
  TC_DWARF2_EMIT_OFFSET (section_symbol (line_seg),
			 (DWARF2_FORMAT (line_seg) == dwarf2_format_32bit
			  ? 4 : 8));

  /* These two attributes are emitted if all of the code is contiguous.  */
  if (all_segs->next == NULL)
    {
      /* DW_AT_low_pc */
      exp.X_op = O_symbol;
      exp.X_add_symbol = all_segs->text_start;
      exp.X_add_number = 0;
      emit_expr (&exp, sizeof_address);

      /* DW_AT_high_pc */
      exp.X_op = O_symbol;
      exp.X_add_symbol = all_segs->text_end;
      exp.X_add_number = 0;
      emit_expr (&exp, sizeof_address);
    }
  else
    {
      /* This attribute is emitted if the code is disjoint.  */
      /* DW_AT_ranges.  */
      TC_DWARF2_EMIT_OFFSET (section_symbol (ranges_seg), sizeof_offset);
    }

  /* DW_AT_name.  We don't have the actual file name that was present
     on the command line, so assume files[1] is the main input file.
     We're not supposed to get called unless at least one line number
     entry was emitted, so this should always be defined.  */
  if (files_in_use == 0)
    abort ();
  if (files[1].dir)
    {
      dirname = remap_debug_filename (dirs[files[1].dir]);
      len = strlen (dirname);
#ifdef TE_VMS
      /* Already has trailing slash.  */
      p = frag_more (len);
      memcpy (p, dirname, len);
#else
      p = frag_more (len + 1);
      memcpy (p, dirname, len);
      INSERT_DIR_SEPARATOR (p, len);
#endif
    }
  len = strlen (files[1].filename) + 1;
  p = frag_more (len);
  memcpy (p, files[1].filename, len);

  /* DW_AT_comp_dir */
  comp_dir = remap_debug_filename (getpwd ());
  len = strlen (comp_dir) + 1;
  p = frag_more (len);
  memcpy (p, comp_dir, len);

  /* DW_AT_producer */
  sprintf (producer, "GNU AS %s", VERSION);
  len = strlen (producer) + 1;
  p = frag_more (len);
  memcpy (p, producer, len);

  /* DW_AT_language.  Yes, this is probably not really MIPS, but the
     dwarf2 draft has no standard code for assembler.  */
  out_two (DW_LANG_Mips_Assembler);

  symbol_set_value_now (info_end);
}
Esempio n. 14
0
static void
out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg)
{
  char producer[128];
  char *comp_dir;
  expressionS expr;
  symbolS *info_start;
  symbolS *info_end;
  char *p;
  int len;
  enum dwarf2_format d2f;
  int sizeof_offset;

  subseg_set (info_seg, 0);

  info_start = symbol_temp_new_now ();
  info_end = symbol_temp_make ();

  /* Compilation Unit length.  */
  expr.X_op = O_subtract;
  expr.X_add_symbol = info_end;
  expr.X_op_symbol = info_start;

  d2f = DWARF2_FORMAT ();
  if (d2f == dwarf2_format_32bit)
    {
      expr.X_add_number = -4;
      emit_expr (&expr, 4);
      sizeof_offset = 4;
    }
  else if (d2f == dwarf2_format_64bit)
    {
      expr.X_add_number = -12;
      out_four (-1);
      emit_expr (&expr, 8);
      sizeof_offset = 8;
    }
  else if (d2f == dwarf2_format_64bit_irix)
    {
      expr.X_add_number = -8;
      emit_expr (&expr, 8);
      sizeof_offset = 8;
    }
  else
    {
      as_fatal (_("internal error: unknown dwarf2 format"));
    }

  /* DWARF version.  */
  out_two (2);

  /* .debug_abbrev offset */
  TC_DWARF2_EMIT_OFFSET (section_symbol (abbrev_seg), sizeof_offset);

  /* Target address size.  */
  out_byte (sizeof_address);

  /* DW_TAG_compile_unit DIE abbrev */
  out_uleb128 (1);

  /* DW_AT_stmt_list */
  /* ??? sizeof_offset */
  TC_DWARF2_EMIT_OFFSET (section_symbol (line_seg), 4);

  /* These two attributes may only be emitted if all of the code is
     contiguous.  Multiple sections are not that.  */
  if (all_segs->next == NULL)
    {
      /* DW_AT_low_pc */
      expr.X_op = O_symbol;
      expr.X_add_symbol = all_segs->text_start;
      expr.X_add_number = 0;
      emit_expr (&expr, sizeof_address);

      /* DW_AT_high_pc */
      expr.X_op = O_symbol;
      expr.X_add_symbol = all_segs->text_end;
      expr.X_add_number = 0;
      emit_expr (&expr, sizeof_address);
    }

  /* DW_AT_name.  We don't have the actual file name that was present
     on the command line, so assume files[1] is the main input file.
     We're not supposed to get called unless at least one line number
     entry was emitted, so this should always be defined.  */
  if (!files || files_in_use < 1)
    abort ();
  if (files[1].dir)
    {
      len = strlen (dirs[files[1].dir]);
      p = frag_more (len + 1);
      memcpy (p, dirs[files[1].dir], len);
      p[len] = '/';
    }
  len = strlen (files[1].filename) + 1;
  p = frag_more (len);
  memcpy (p, files[1].filename, len);

  /* DW_AT_comp_dir */
  comp_dir = getpwd ();
  len = strlen (comp_dir) + 1;
  p = frag_more (len);
  memcpy (p, comp_dir, len);

  /* DW_AT_producer */
  sprintf (producer, "GNU AS %s", VERSION);
  len = strlen (producer) + 1;
  p = frag_more (len);
  memcpy (p, producer, len);

  /* DW_AT_language.  Yes, this is probably not really MIPS, but the
     dwarf2 draft has no standard code for assembler.  */
  out_two (DW_LANG_Mips_Assembler);

  symbol_set_value_now (info_end);
}
int ReadConfig(){
	char *file = "email.ini";
	ifstream fin(file);
	string line;
	int nSize = 0, ret = 0;
	char str1[64], str2[64], c;

	if(!fin.is_open()){
		MessageBox(NULL, L"配置文件打开失败", L"警告", MB_OK | MB_ICONWARNING);
		return -1;
	}
	
	while(getline(fin, line)){
		nSize = line.size();
		if(nSize < 1) continue;
		if(line[0] == '#'){
			continue;
		}else{
			ret = sscanf(line.c_str(), "%[^=]=%[^\0]", str1, str2);
			if(ret != 2) continue;

			if(strcmp(str1, "receiver") == 0){
				memcpy(receiver, str2, strlen(str2)+1);
			}else if(strcmp(str1, "sender") == 0){
				memcpy(sender, str2, strlen(str2)+1);
			}else if(strcmp(str1, "title") == 0){
				memcpy(sendtitle, str2, strlen(str2)+1);
			}else if(strcmp(str1, "serverip") == 0){
				memcpy(serverip, str2, strlen(str2)+1);
			}else if(strcmp(str1, "servername") == 0){
				memcpy(servername, str2, strlen(str2)+1);
			}else{
				continue;
			}
		}
	}

	printf("Please input password of e-mail [%s]: ", sender);
	//scanf("%s", senderpwd);
	getpwd(senderpwd);
	
	printf("\nWait...\r");
	if(SendMail("E-mail Test") == 0){
		printf("E-mail test success\n");
		flog = fopen("log.txt", "a");
		if(flog == NULL){
			printf("Log open failed\n");
		}else{
			printf("Log open success\n");
		}
		printf("Press 'y' to continue, 'n' to end: ");
		fflush(stdin);
		scanf("%c", &c);
		if(c == 'y'){
			return 0;
		}else{
			return -1;
		}
	}else{
		printf("E-mail test failed\r");
		printf("Some E-mail configuration information incorrect\n");
		return -1;
	}

	

	return 0;
}