Fossil

Check-in [ed20da7499]
Login

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

Overview
Comment:Simplify command line interaction: remove settings from global and provide one less command line option. Altering settings in open fossils can be done with sync -l or cleared with remote-url if necessary.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | ssh-test-http
Files: files | file ages | folders
SHA1: ed20da74998324afe3534f357491ba11d54b0679
User & Date: andybradford 2013-08-12 06:43:56.706
Context
2013-08-16
03:25
Merge in all new development from trunk. check-in: 535cba9158 user: andybradford tags: ssh-test-http
2013-08-12
06:43
Simplify command line interaction: remove settings from global and provide one less command line option. Altering settings in open fossils can be done with sync -l or cleared with remote-url if necessary. check-in: ed20da7499 user: andybradford tags: ssh-test-http
2013-08-10
23:02
Clean up handling of global variable to avoid accidental setting of database. Only alter database options if URL is SSH. check-in: 0c19424325 user: andybradford tags: ssh-test-http
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/clone.c.
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
** Options:
**    --admin-user|-A USERNAME   Make USERNAME the administrator
**    --private                  Also clone private branches 
**    --ssl-identity=filename    Use the SSL identity if requested by the server
**    --ssh-fossil|-f /fossil    Use this path as remote fossil command
**    --ssh-command|-c 'command' Use this SSH command
**    --ssh-fossil-user|-l user  Fossil user to use for SSH if different.
**    --ssh-use-http|-h on/off   Enable http instead of test-http. Default: off
**
** See also: init
*/
void clone_cmd(void){
  char *zPassword;
  const char *zDefaultUser;   /* Optional name of the default user */
  int nErr = 0;







<







94
95
96
97
98
99
100

101
102
103
104
105
106
107
** Options:
**    --admin-user|-A USERNAME   Make USERNAME the administrator
**    --private                  Also clone private branches 
**    --ssl-identity=filename    Use the SSL identity if requested by the server
**    --ssh-fossil|-f /fossil    Use this path as remote fossil command
**    --ssh-command|-c 'command' Use this SSH command
**    --ssh-fossil-user|-l user  Fossil user to use for SSH if different.

**
** See also: init
*/
void clone_cmd(void){
  char *zPassword;
  const char *zDefaultUser;   /* Optional name of the default user */
  int nErr = 0;
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/*
** Look for SSH clone command line options and setup in globals.
*/
void clone_ssh_find_options(void){
  const char *zSshFossilCmd;  /* Path to remote fossil command for SSH */
  const char *zSshCmd;        /* SSH command string */
  const char *zFossilUser;    /* Fossil user if login specified for SSH */
  const char *zSshUseHttp;    /* Use http or test-http mode for SSH */

  zSshFossilCmd = find_option("ssh-fossil","f",1);
  if( zSshFossilCmd && zSshFossilCmd[0] ){
    g.zSshFossilCmd = mprintf("%s", zSshFossilCmd);
  }
  zSshCmd = find_option("ssh-command","c",1);
  if( zSshCmd && zSshCmd[0] ){
    g.zSshCmd = mprintf("%s", zSshCmd);
  }
  zFossilUser = find_option("ssh-fossil-user","l",1);
  if( zFossilUser && zFossilUser[0] ){
    g.zFossilUser = mprintf("%s", zFossilUser);
  }
  zSshUseHttp = find_option("ssh-use-http","h",1);
  if( zSshUseHttp && zSshUseHttp[0] ){
    g.zSshUseHttp = mprintf("%s", zSshUseHttp);
  }
}

/*
** Set SSH options discovered in global variables (set from command line 
** options).
*/
void clone_ssh_db_set_options(void){
  if( g.urlIsSsh ){
    if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){
      db_set("ssh-fossil", g.zSshFossilCmd, 0);
    }
    if( g.zSshCmd && g.zSshCmd[0] ){
      db_set("ssh-command", g.zSshCmd, 0);
    }
    if( g.zFossilUser && g.zFossilUser[0] ){
      db_set("ssh-fossil-user", g.zFossilUser, 0);
    }
    if( g.zSshUseHttp && g.zSshUseHttp[0] ){
      db_set_int("ssh-use-http", is_truth(g.zSshUseHttp), 0);
    }
  }
}







<













<
<
<
<







<
|
|
|
|
|
|
|
|
|
<
<
|
<
<
185
186
187
188
189
190
191

192
193
194
195
196
197
198
199
200
201
202
203
204




205
206
207
208
209
210
211

212
213
214
215
216
217
218
219
220


221


/*
** Look for SSH clone command line options and setup in globals.
*/
void clone_ssh_find_options(void){
  const char *zSshFossilCmd;  /* Path to remote fossil command for SSH */
  const char *zSshCmd;        /* SSH command string */
  const char *zFossilUser;    /* Fossil user if login specified for SSH */


  zSshFossilCmd = find_option("ssh-fossil","f",1);
  if( zSshFossilCmd && zSshFossilCmd[0] ){
    g.zSshFossilCmd = mprintf("%s", zSshFossilCmd);
  }
  zSshCmd = find_option("ssh-command","c",1);
  if( zSshCmd && zSshCmd[0] ){
    g.zSshCmd = mprintf("%s", zSshCmd);
  }
  zFossilUser = find_option("ssh-fossil-user","l",1);
  if( zFossilUser && zFossilUser[0] ){
    g.zFossilUser = mprintf("%s", zFossilUser);
  }




}

/*
** Set SSH options discovered in global variables (set from command line 
** options).
*/
void clone_ssh_db_set_options(void){

  if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){
    db_set("ssh-fossil", g.zSshFossilCmd, 0);
  }
  if( g.zSshCmd && g.zSshCmd[0] ){
    db_set("ssh-command", g.zSshCmd, 0);
  }
  if( g.zFossilUser && g.zFossilUser[0] ){
    db_set("ssh-fossil-user", g.zFossilUser, 0);
  }


}


Changes to src/db.c.
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
  { "pgp-command",   0,               40, 0, "gpg --clearsign -o " },
  { "proxy",         0,               32, 0, "off"                 },
  { "relative-paths",0,                0, 0, "on"                  },
  { "repo-cksum",    0,                0, 0, "on"                  },
  { "self-register", 0,                0, 0, "off"                 },
  { "ssh-command",   0,               40, 0, ""                    },
  { "ssh-fossil",    0,               40, 0, ""                    },
  { "ssh-fossil-user",  0,            40, 0, ""                    },
  { "ssh-use-http",  0,               40, 0, "off"                 },
  { "ssl-ca-location",0,              40, 0, ""                    },
  { "ssl-identity",  0,               40, 0, ""                    },
#ifdef FOSSIL_ENABLE_TCL
  { "tcl",           0,                0, 0, "off"                 },
  { "tcl-setup",     0,               40, 0, ""                    },
#endif
  { "th1-setup",     0,               40, 0, ""                    },







<
<







2133
2134
2135
2136
2137
2138
2139


2140
2141
2142
2143
2144
2145
2146
  { "pgp-command",   0,               40, 0, "gpg --clearsign -o " },
  { "proxy",         0,               32, 0, "off"                 },
  { "relative-paths",0,                0, 0, "on"                  },
  { "repo-cksum",    0,                0, 0, "on"                  },
  { "self-register", 0,                0, 0, "off"                 },
  { "ssh-command",   0,               40, 0, ""                    },
  { "ssh-fossil",    0,               40, 0, ""                    },


  { "ssl-ca-location",0,              40, 0, ""                    },
  { "ssl-identity",  0,               40, 0, ""                    },
#ifdef FOSSIL_ENABLE_TCL
  { "tcl",           0,                0, 0, "off"                 },
  { "tcl-setup",     0,               40, 0, ""                    },
#endif
  { "th1-setup",     0,               40, 0, ""                    },
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
**                     users can not be deleted. Default: off.
**
**    ssh-command      Command used to talk to a remote machine with
**                     the "ssh://" protocol.
**
**    ssh-fossil       Remote fossil command to run with the "ssh://" protocol.
**
**    ssh-fossil-user  Fossil user to use instead of the URL user.
**
**    ssh-use-http     Use http instead of test-http. Default: off.
**
**    ssl-ca-location  The full pathname to a file containing PEM encoded
**                     CA root certificates, or a directory of certificates
**                     with filenames formed from the certificate hashes as
**                     required by OpenSSL.
**                     If set, this will override the OS default list of
**                     OpenSSL CAs. If unset, the default list will be used.
**                     Some platforms may add additional certificates.







<
<
<
<







2306
2307
2308
2309
2310
2311
2312




2313
2314
2315
2316
2317
2318
2319
**                     users can not be deleted. Default: off.
**
**    ssh-command      Command used to talk to a remote machine with
**                     the "ssh://" protocol.
**
**    ssh-fossil       Remote fossil command to run with the "ssh://" protocol.
**




**    ssl-ca-location  The full pathname to a file containing PEM encoded
**                     CA root certificates, or a directory of certificates
**                     with filenames formed from the certificate hashes as
**                     required by OpenSSL.
**                     If set, this will override the OS default list of
**                     OpenSSL CAs. If unset, the default list will be used.
**                     Some platforms may add additional certificates.
Changes to src/http_transport.c.
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
    zHost = mprintf("%s", g.urlName);
  }
  n = blob_size(&zCmd);
  blob_append(&zCmd, " ", 1);
  shell_escape(&zCmd, zHost);
  blob_append(&zCmd, " ", 1);
  shell_escape(&zCmd, mprintf("%s", zSshFossilCmd));
  if( db_get_boolean("ssh-use-http", 0) ){
    blob_append(&zCmd, " http", 5);
  }else{
    blob_append(&zCmd, " test-http", 10);
  }
  if( g.urlPath && g.urlPath[0] ){
    blob_append(&zCmd, " ", 1);
    shell_escape(&zCmd, mprintf("%s", g.urlPath));







|







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
    zHost = mprintf("%s", g.urlName);
  }
  n = blob_size(&zCmd);
  blob_append(&zCmd, " ", 1);
  shell_escape(&zCmd, zHost);
  blob_append(&zCmd, " ", 1);
  shell_escape(&zCmd, mprintf("%s", zSshFossilCmd));
  if( url_ssh_use_http() ){
    blob_append(&zCmd, " http", 5);
  }else{
    blob_append(&zCmd, " test-http", 10);
  }
  if( g.urlPath && g.urlPath[0] ){
    blob_append(&zCmd, " ", 1);
    shell_escape(&zCmd, mprintf("%s", g.urlPath));
Changes to src/main.c.
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
  int fSqlTrace;          /* True if --sqltrace flag is present */
  int fSqlStats;          /* True if --sqltrace or --sqlstats are present */
  int fSqlPrint;          /* True if -sqlprint flag is present */
  int fQuiet;             /* True if -quiet flag is present */
  int fHttpTrace;         /* Trace outbound HTTP requests */
  int fSystemTrace;       /* Trace calls to fossil_system(), --systemtrace */
  int fSshTrace;          /* Trace the SSH setup traffic */
  char *zSshUseHttp;      /* Use http or test-http mode for SSH */
  char *zSshFossilCmd;    /* Path to remoe fossil command for SSH */
  char *zSshCmd;          /* SSH command string */
  char *zFossilUser;      /* Fossil user if different from URL user */
  int fNoSync;            /* Do not do an autosync ever.  --nosync */
  char *zPath;            /* Name of webpage being served */
  char *zExtra;           /* Extra path information past the webpage name */
  char *zBaseURL;         /* Full text of the URL being served */







<







132
133
134
135
136
137
138

139
140
141
142
143
144
145
  int fSqlTrace;          /* True if --sqltrace flag is present */
  int fSqlStats;          /* True if --sqltrace or --sqlstats are present */
  int fSqlPrint;          /* True if -sqlprint flag is present */
  int fQuiet;             /* True if -quiet flag is present */
  int fHttpTrace;         /* Trace outbound HTTP requests */
  int fSystemTrace;       /* Trace calls to fossil_system(), --systemtrace */
  int fSshTrace;          /* Trace the SSH setup traffic */

  char *zSshFossilCmd;    /* Path to remoe fossil command for SSH */
  char *zSshCmd;          /* SSH command string */
  char *zFossilUser;      /* Fossil user if different from URL user */
  int fNoSync;            /* Do not do an autosync ever.  --nosync */
  char *zPath;            /* Name of webpage being served */
  char *zExtra;           /* Extra path information past the webpage name */
  char *zBaseURL;         /* Full text of the URL being served */
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
    const char *zChdir = find_option("chdir",0,1);
    g.isHTTP = 0;
    g.fQuiet = find_option("quiet", 0, 0)!=0;
    g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
    g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
    g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
    g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
    g.zSshUseHttp = 0;
    g.zSshFossilCmd = 0;
    g.zSshCmd = 0;
    g.zFossilUser = 0;
    if( g.fSqlTrace ) g.fSqlStats = 1;
    g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
    g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
    g.zLogin = find_option("user", "U", 1);







<







579
580
581
582
583
584
585

586
587
588
589
590
591
592
    const char *zChdir = find_option("chdir",0,1);
    g.isHTTP = 0;
    g.fQuiet = find_option("quiet", 0, 0)!=0;
    g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
    g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
    g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
    g.fSshTrace = find_option("sshtrace", 0, 0)!=0;

    g.zSshFossilCmd = 0;
    g.zSshCmd = 0;
    g.zFossilUser = 0;
    if( g.fSqlTrace ) g.fSqlStats = 1;
    g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
    g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
    g.zLogin = find_option("user", "U", 1);
Changes to src/sync.c.
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
    ** Maybe the shunning list should only be pulled on every 10th
    ** autosync, or something?
    */
    configSync = CONFIGSET_SHUN;
  }
#endif
  if( find_option("verbose","v",0)!=0 ) flags |= SYNC_VERBOSE;
  is_fossil_user() && url_ssh_use_http() ?
    fossil_print("Autosync: (%s) %s\n", get_fossil_user(), g.urlCanonical) :
    fossil_print("Autosync:  %s\n", g.urlCanonical);
  url_enable_proxy("via proxy: ");
  rc = client_sync(flags, configSync, 0);
  if( rc ) fossil_warning("Autosync failed");
  return rc;
}







|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
    ** Maybe the shunning list should only be pulled on every 10th
    ** autosync, or something?
    */
    configSync = CONFIGSET_SHUN;
  }
#endif
  if( find_option("verbose","v",0)!=0 ) flags |= SYNC_VERBOSE;
  is_fossil_user() ?
    fossil_print("Autosync: (%s) %s\n", get_fossil_user(), g.urlCanonical) :
    fossil_print("Autosync:  %s\n", g.urlCanonical);
  url_enable_proxy("via proxy: ");
  rc = client_sync(flags, configSync, 0);
  if( rc ) fossil_warning("Autosync failed");
  return rc;
}
112
113
114
115
116
117
118



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
  clone_ssh_find_options();
  db_find_and_open_repository(0, 0);
  db_open_config(0);
  if( g.argc==2 ){
    if( db_get_boolean("auto-shun",1) ) configSync = CONFIGSET_SHUN;
  }else if( g.argc==3 ){
    zUrl = g.argv[2];



  }
  if( urlFlags & URL_REMEMBER ){
    clone_ssh_db_set_options();
  }
  url_parse(zUrl, urlFlags);
  if( g.urlProtocol==0 ){
    if( urlOptional ) fossil_exit(0);
    usage("URL");
  }
  user_select();
  if( g.argc==2 ){
    if( ((*pSyncFlags) & (SYNC_PUSH|SYNC_PULL))==(SYNC_PUSH|SYNC_PULL) ){
      is_fossil_user() && url_ssh_use_http() ? 
        fossil_print("Sync with (%s) %s\n",get_fossil_user(),g.urlCanonical):
        fossil_print("Sync with %s\n", g.urlCanonical);
    }else if( (*pSyncFlags) & SYNC_PUSH ){
      is_fossil_user() && url_ssh_use_http() ? 
        fossil_print("Push to (%s) %s\n", get_fossil_user(), g.urlCanonical):
        fossil_print("Push to %s\n", g.urlCanonical);
    }else if( (*pSyncFlags) & SYNC_PULL ){
      is_fossil_user() && url_ssh_use_http() ? 
        fossil_print("Pull from (%s) %s\n",get_fossil_user(),g.urlCanonical):
        fossil_print("Pull from %s\n", g.urlCanonical);
    }
  }
  url_enable_proxy("via proxy: ");
  *pConfigFlags |= configSync;
}







>
>
>












|



|



|







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
  clone_ssh_find_options();
  db_find_and_open_repository(0, 0);
  db_open_config(0);
  if( g.argc==2 ){
    if( db_get_boolean("auto-shun",1) ) configSync = CONFIGSET_SHUN;
  }else if( g.argc==3 ){
    zUrl = g.argv[2];
    if( urlFlags & URL_REMEMBER ){
      db_unset("ssh-fossil-user", 0);
    }
  }
  if( urlFlags & URL_REMEMBER ){
    clone_ssh_db_set_options();
  }
  url_parse(zUrl, urlFlags);
  if( g.urlProtocol==0 ){
    if( urlOptional ) fossil_exit(0);
    usage("URL");
  }
  user_select();
  if( g.argc==2 ){
    if( ((*pSyncFlags) & (SYNC_PUSH|SYNC_PULL))==(SYNC_PUSH|SYNC_PULL) ){
      is_fossil_user() ? 
        fossil_print("Sync with (%s) %s\n",get_fossil_user(),g.urlCanonical):
        fossil_print("Sync with %s\n", g.urlCanonical);
    }else if( (*pSyncFlags) & SYNC_PUSH ){
      is_fossil_user() ? 
        fossil_print("Push to (%s) %s\n", get_fossil_user(), g.urlCanonical):
        fossil_print("Push to %s\n", g.urlCanonical);
    }else if( (*pSyncFlags) & SYNC_PULL ){
      is_fossil_user() ? 
        fossil_print("Pull from (%s) %s\n",get_fossil_user(),g.urlCanonical):
        fossil_print("Pull from %s\n", g.urlCanonical);
    }
  }
  url_enable_proxy("via proxy: ");
  *pConfigFlags |= configSync;
}
265
266
267
268
269
270
271

272
273
274
275
276
277
278
279
280


281
282
283
  db_find_and_open_repository(0, 0);
  if( g.argc!=2 && g.argc!=3 ){
    usage("remote-url ?URL|off?");
  }
  if( g.argc==3 ){
    db_unset("last-sync-url", 0);
    db_unset("last-sync-pw", 0);

    if( is_false(g.argv[2]) ) return;
    url_parse(g.argv[2], URL_REMEMBER|URL_PROMPT_PW);
  }
  zUrl = db_get("last-sync-url", 0);
  if( zUrl==0 ){
    fossil_print("off\n");
    return;
  }else{
    url_parse(zUrl, 0);


    fossil_print("%s\n", g.urlCanonical);
  }
}







>









>
>
|


268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
  db_find_and_open_repository(0, 0);
  if( g.argc!=2 && g.argc!=3 ){
    usage("remote-url ?URL|off?");
  }
  if( g.argc==3 ){
    db_unset("last-sync-url", 0);
    db_unset("last-sync-pw", 0);
    db_unset("ssh-fossil-user", 0);
    if( is_false(g.argv[2]) ) return;
    url_parse(g.argv[2], URL_REMEMBER|URL_PROMPT_PW);
  }
  zUrl = db_get("last-sync-url", 0);
  if( zUrl==0 ){
    fossil_print("off\n");
    return;
  }else{
    url_parse(zUrl, 0);
    is_fossil_user() ?
      fossil_print("(%s) %s\n", get_fossil_user(), g.urlCanonical) :
      fossil_print("%s\n", g.urlCanonical);
  }
}
Changes to src/url.c.
75
76
77
78
79
80
81








82
83
84
85
86
87
88
  int bPrompted = 0;
  int bSetUrl = 1;
 
  if( zUrl==0 ){
    zUrl = db_get("last-sync-url", 0);
    if( zUrl==0 ) return;
    g.urlPasswd = unobscure(db_get("last-sync-pw", 0));








    bSetUrl = 0;
  }

  if( strncmp(zUrl, "http://", 7)==0
   || strncmp(zUrl, "https://", 8)==0
   || strncmp(zUrl, "ssh://", 6)==0
  ){







>
>
>
>
>
>
>
>







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
  int bPrompted = 0;
  int bSetUrl = 1;
 
  if( zUrl==0 ){
    zUrl = db_get("last-sync-url", 0);
    if( zUrl==0 ) return;
    g.urlPasswd = unobscure(db_get("last-sync-pw", 0));
    if( g.zFossilUser==0 ){
      g.zFossilUser = db_get("ssh-fossil-user", 0);
    }else{
      if( g.urlPasswd ) {
        free(g.urlPasswd);
        g.urlPasswd = 0;
      }
    }
    bSetUrl = 0;
  }

  if( strncmp(zUrl, "http://", 7)==0
   || strncmp(zUrl, "https://", 8)==0
   || strncmp(zUrl, "ssh://", 6)==0
  ){
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
  }
}

/*
** Return true if http mode is in use for "ssh://" URL.
*/
int url_ssh_use_http(void){
  return ( g.zSshUseHttp && g.zSshUseHttp[0] ) ? is_truth(g.zSshUseHttp) :
    db_get_boolean("ssh-use-http", 0);
}

/*
** Remember the URL if requested.
*/
void url_remember(void){
  db_set("last-sync-url", g.urlCanonical, 0);







|
<







441
442
443
444
445
446
447
448

449
450
451
452
453
454
455
  }
}

/*
** Return true if http mode is in use for "ssh://" URL.
*/
int url_ssh_use_http(void){
  return get_fossil_user()!=0;

}

/*
** Remember the URL if requested.
*/
void url_remember(void){
  db_set("last-sync-url", g.urlCanonical, 0);
Changes to src/user.c.
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
** Return Fossil user if allocated and URL is SSH or URL user
*/
const char *url_or_fossil_user(void){
  return is_fossil_user() ? get_fossil_user() : g.urlUser;
}

/*
** Return the Fossil user from global variable (set from command line
** or ssh-fossil-user database setting.
*/
const char *get_fossil_user(void){
  return ( g.zFossilUser && g.zFossilUser[0] ) ? g.zFossilUser :
    db_get("ssh-fossil-user", 0);
}








|







162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
** Return Fossil user if allocated and URL is SSH or URL user
*/
const char *url_or_fossil_user(void){
  return is_fossil_user() ? get_fossil_user() : g.urlUser;
}

/*
** Return the Fossil user from global variable (set from command line)
** or ssh-fossil-user database setting.
*/
const char *get_fossil_user(void){
  return ( g.zFossilUser && g.zFossilUser[0] ) ? g.zFossilUser :
    db_get("ssh-fossil-user", 0);
}