Fossil

Check-in [34d988c2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Coding style tweaks.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | seeEnhanced
Files: files | file ages | folders
SHA1: 34d988c2444c71aeada3675e5110d4bc2007dca4
User & Date: mistachkin 2016-10-04 19:17:25
Context
2016-10-26
21:31
Minor security enhancements to the optional SEE integration. check-in: a8484dc3 user: mistachkin tags: trunk
2016-10-23
02:07
Minor security enhancements to the optional SEE integration. check-in: 69352027 user: mistachkin tags: experimental
2016-10-04
19:17
Coding style tweaks. Closed-Leaf check-in: 34d988c2 user: mistachkin tags: seeEnhanced
19:07
Merge updates from trunk. check-in: 04a8ee6e user: mistachkin tags: seeEnhanced
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/user.c.

45
46
47
48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
64

65
66

67
68
69
70
71
72
73
74
75
..
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include <conio.h>
#endif

/*
** getpass() for Windows and Android.
*/
static char *zPwdBuffer = 0;
static size_t pwdBufferSize = 0;

static char *getpass(const char *prompt){
  char *zPwd;

  size_t i;

  if( zPwdBuffer==0 ){
    zPwdBuffer = fossil_secure_alloc_page(&pwdBufferSize);
    assert( zPwdBuffer );
  }else{
    fossil_secure_zero(zPwdBuffer, pwdBufferSize);
  }
  zPwd = zPwdBuffer;

  fputs(prompt,stderr);
  fflush(stderr);

  assert( pwdBufferSize>0 );
  for(i=0; i<pwdBufferSize-1; ++i){
#if defined(_WIN32)
    zPwd[i] = _getch();
#else
    zPwd[i] = getc(stdin);
#endif
    if(zPwd[i]=='\r' || zPwd[i]=='\n'){
      break;
................................................................................
  zPwd[i]='\0';
  fputs("\n", stderr);
  assert( zPwd==zPwdBuffer );
  return zPwd;
}
void freepass(){
  if( !zPwdBuffer ) return;
  assert( pwdBufferSize>0 );
  fossil_secure_free_page(zPwdBuffer, pwdBufferSize);
}
#endif

#if defined(_WIN32) || defined(WIN32)
# include <io.h>
# include <fcntl.h>
# undef popen







|



>



|


|


>


>
|
|







 







|
|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include <conio.h>
#endif

/*
** getpass() for Windows and Android.
*/
static char *zPwdBuffer = 0;
static size_t nPwdBuffer = 0;

static char *getpass(const char *prompt){
  char *zPwd;
  size_t nPwd;
  size_t i;

  if( zPwdBuffer==0 ){
    zPwdBuffer = fossil_secure_alloc_page(&nPwdBuffer);
    assert( zPwdBuffer );
  }else{
    fossil_secure_zero(zPwdBuffer, nPwdBuffer);
  }
  zPwd = zPwdBuffer;
  nPwd = nPwdBuffer;
  fputs(prompt,stderr);
  fflush(stderr);
  assert( zPwd!=0 );
  assert( nPwd>0 );
  for(i=0; i<nPwd-1; ++i){
#if defined(_WIN32)
    zPwd[i] = _getch();
#else
    zPwd[i] = getc(stdin);
#endif
    if(zPwd[i]=='\r' || zPwd[i]=='\n'){
      break;
................................................................................
  zPwd[i]='\0';
  fputs("\n", stderr);
  assert( zPwd==zPwdBuffer );
  return zPwd;
}
void freepass(){
  if( !zPwdBuffer ) return;
  assert( nPwdBuffer>0 );
  fossil_secure_free_page(zPwdBuffer, nPwdBuffer);
}
#endif

#if defined(_WIN32) || defined(WIN32)
# include <io.h>
# include <fcntl.h>
# undef popen