client.c (102843) | client.c (107487) |
---|---|
1/* JT thinks BeOS is worth the trouble. */ 2 3/* CVS client-related stuff. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2, or (at your option) 8 any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. */ 14 15/* | 1/* JT thinks BeOS is worth the trouble. */ 2 3/* CVS client-related stuff. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2, or (at your option) 8 any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. */ 14 15/* |
16 * $FreeBSD: head/contrib/cvs/src/client.c 102843 2002-09-02 05:57:14Z peter $ | 16 * $FreeBSD: head/contrib/cvs/src/client.c 107487 2002-12-02 03:17:49Z peter $ |
17 */ 18 19#ifdef HAVE_CONFIG_H 20# include "config.h" 21#endif /* HAVE_CONFIG_H */ 22 23#include <assert.h> 24#include "cvs.h" --- 221 unchanged lines hidden (view full) --- 246 files on disk. */ 247 this_root = Name_Root (arg, (char *) NULL); 248 *t = c; 249 } 250 else 251 { 252 /* We're at the beginning of the string. Look at the 253 CVSADM files in cwd. */ | 17 */ 18 19#ifdef HAVE_CONFIG_H 20# include "config.h" 21#endif /* HAVE_CONFIG_H */ 22 23#include <assert.h> 24#include "cvs.h" --- 221 unchanged lines hidden (view full) --- 246 files on disk. */ 247 this_root = Name_Root (arg, (char *) NULL); 248 *t = c; 249 } 250 else 251 { 252 /* We're at the beginning of the string. Look at the 253 CVSADM files in cwd. */ |
254 this_root = Name_Root ((char *) NULL, (char *) NULL); | 254 this_root = (CVSroot_cmdline ? xstrdup(CVSroot_cmdline) 255 : Name_Root ((char *) NULL, (char *) NULL)); |
255 } 256 257 /* Now check the value for root. */ 258 if (CVSroot_cmdline == NULL && this_root && current_parsed_root 259 && (strcmp (this_root, current_parsed_root->original) != 0)) 260 { 261 /* Don't send this, since the CVSROOTs don't match. */ 262 free (this_root); --- 1056 unchanged lines hidden (view full) --- 1319 } 1320 1321 } while (dirp != NULL); 1322 free (dir); 1323 /* Now it better work. */ 1324 if ( CVS_CHDIR (dir_name) < 0) 1325 error (1, errno, "could not chdir to %s", dir_name); 1326 } | 256 } 257 258 /* Now check the value for root. */ 259 if (CVSroot_cmdline == NULL && this_root && current_parsed_root 260 && (strcmp (this_root, current_parsed_root->original) != 0)) 261 { 262 /* Don't send this, since the CVSROOTs don't match. */ 263 free (this_root); --- 1056 unchanged lines hidden (view full) --- 1320 } 1321 1322 } while (dirp != NULL); 1323 free (dir); 1324 /* Now it better work. */ 1325 if ( CVS_CHDIR (dir_name) < 0) 1326 error (1, errno, "could not chdir to %s", dir_name); 1327 } |
1328 else if (strcmp (command_name, "export") == 0) 1329 /* Don't create CVSADM directories if this is export. */ 1330 ; |
|
1327 else if (!isdir (CVSADM)) 1328 { 1329 /* 1330 * Put repository in CVS/Repository. For historical 1331 * (pre-CVS/Root) reasons, this is an absolute pathname, 1332 * but what really matters is the part of it which is 1333 * relative to cvsroot. 1334 */ --- 2273 unchanged lines hidden (view full) --- 3608 /* First we shut down TO_SERVER. That tells the server that its input is 3609 * finished. It then shuts down the buffer it is sending to us, at which 3610 * point our shut down of FROM_SERVER will complete. 3611 */ 3612 3613 status = buf_shutdown (to_server); 3614 if (status != 0) 3615 error (0, status, "shutting down buffer to server"); | 1331 else if (!isdir (CVSADM)) 1332 { 1333 /* 1334 * Put repository in CVS/Repository. For historical 1335 * (pre-CVS/Root) reasons, this is an absolute pathname, 1336 * but what really matters is the part of it which is 1337 * relative to cvsroot. 1338 */ --- 2273 unchanged lines hidden (view full) --- 3612 /* First we shut down TO_SERVER. That tells the server that its input is 3613 * finished. It then shuts down the buffer it is sending to us, at which 3614 * point our shut down of FROM_SERVER will complete. 3615 */ 3616 3617 status = buf_shutdown (to_server); 3618 if (status != 0) 3619 error (0, status, "shutting down buffer to server"); |
3620 buf_free (to_server); 3621 to_server = NULL; 3622 |
|
3616 status = buf_shutdown (from_server); 3617 if (status != 0) 3618 error (0, status, "shutting down buffer from server"); | 3623 status = buf_shutdown (from_server); 3624 if (status != 0) 3625 error (0, status, "shutting down buffer from server"); |
3619 3620 buf_free (to_server); | |
3621 buf_free (from_server); | 3626 buf_free (from_server); |
3627 from_server = NULL; |
|
3622 server_started = 0; 3623 3624 /* see if we need to sleep before returning to avoid time-stamp races */ 3625 if (last_register_time) 3626 { 3627 sleep_past (last_register_time); 3628 } 3629 --- 89 unchanged lines hidden (view full) --- 3719 3720 3721/* get the port number for a client to connect to based on the port 3722 * and method of a cvsroot_t. 3723 * 3724 * we do this here instead of in parse_cvsroot so that we can keep network 3725 * code confined to a localized area and also to delay the lookup until the 3726 * last possible moment so it remains possible to run cvs client commands that | 3628 server_started = 0; 3629 3630 /* see if we need to sleep before returning to avoid time-stamp races */ 3631 if (last_register_time) 3632 { 3633 sleep_past (last_register_time); 3634 } 3635 --- 89 unchanged lines hidden (view full) --- 3725 3726 3727/* get the port number for a client to connect to based on the port 3728 * and method of a cvsroot_t. 3729 * 3730 * we do this here instead of in parse_cvsroot so that we can keep network 3731 * code confined to a localized area and also to delay the lookup until the 3732 * last possible moment so it remains possible to run cvs client commands that |
3727 * skip opening connections to the server (i.e. skip network operations entirely) | 3733 * skip opening connections to the server (i.e. skip network operations 3734 * entirely) |
3728 * | 3735 * |
3729 * and yes, I know none of the the commands do that now, but here's to planning | 3736 * and yes, I know none of the commands do that now, but here's to planning |
3730 * for the future, eh? cheers. 3731 * 3732 * FIXME - We could cache the port lookup safely right now as we never change 3733 * it for a single root on the fly, but we'd have to un'const some other | 3737 * for the future, eh? cheers. 3738 * 3739 * FIXME - We could cache the port lookup safely right now as we never change 3740 * it for a single root on the fly, but we'd have to un'const some other |
3734 * functions | 3741 * functions - REMOVE_FIXME? This may be unecessary. We're talking about, 3742 * what, usually one, sometimes two lookups of the port per invocation. I 3743 * think twice is by far the rarer of the two cases - only the login function 3744 * will need to do it to save the canonical CVSROOT. -DRP |
3735 */ 3736int 3737get_cvs_port_number (root) 3738 const cvsroot_t *root; 3739{ 3740 3741 if (root->port) return root->port; 3742 --- 163 unchanged lines hidden (view full) --- 3906 3907 if (verify_only) 3908 { 3909 int status; 3910 3911 status = buf_shutdown (to_server); 3912 if (status != 0) 3913 error (0, status, "shutting down buffer to server"); | 3745 */ 3746int 3747get_cvs_port_number (root) 3748 const cvsroot_t *root; 3749{ 3750 3751 if (root->port) return root->port; 3752 --- 163 unchanged lines hidden (view full) --- 3916 3917 if (verify_only) 3918 { 3919 int status; 3920 3921 status = buf_shutdown (to_server); 3922 if (status != 0) 3923 error (0, status, "shutting down buffer to server"); |
3924 buf_free (to_server); 3925 to_server = NULL; 3926 |
|
3914 status = buf_shutdown (from_server); 3915 if (status != 0) 3916 error (0, status, "shutting down buffer from server"); | 3927 status = buf_shutdown (from_server); 3928 if (status != 0) 3929 error (0, status, "shutting down buffer from server"); |
3917 3918 buf_free (to_server); | |
3919 buf_free (from_server); | 3930 buf_free (from_server); |
3931 from_server = NULL; |
|
3920 3921 /* Don't need to set server_started = 0 since we don't set it to 1 3922 * until returning from this call. 3923 */ 3924 } 3925 else 3926 { 3927 *to_server_p = to_server; --- 28 unchanged lines hidden (view full) --- 3956 */ 3957 to_server = lto_server; 3958 from_server = lfrom_server; 3959 3960 /* Run the authorization mini-protocol before anything else. */ 3961 if (do_gssapi) 3962 { 3963#ifdef HAVE_GSSAPI | 3932 3933 /* Don't need to set server_started = 0 since we don't set it to 1 3934 * until returning from this call. 3935 */ 3936 } 3937 else 3938 { 3939 *to_server_p = to_server; --- 28 unchanged lines hidden (view full) --- 3968 */ 3969 to_server = lto_server; 3970 from_server = lfrom_server; 3971 3972 /* Run the authorization mini-protocol before anything else. */ 3973 if (do_gssapi) 3974 { 3975#ifdef HAVE_GSSAPI |
3964 int fd = (int) lto_server->closure; | 3976 FILE *fp = stdio_buffer_get_file(lto_server); 3977 int fd = fp ? fileno(fp) : -1; |
3965 struct stat s; 3966 | 3978 struct stat s; 3979 |
3967 if (fstat (fd, &s) < 0 || !S_ISSOCK(s.st_mode)) | 3980 if ((fd < 0) || (fstat (fd, &s) < 0) || !S_ISSOCK(s.st_mode)) |
3968 { 3969 error (1, 0, "gserver currently only enabled for socket connections"); 3970 } 3971 3972 if (! connect_to_gserver (root, fd, hostinfo)) 3973 { 3974 error (1, 0, 3975 "authorization failed: server %s rejected access to %s", --- 1642 unchanged lines hidden (view full) --- 5618 */ 5619 args.build_dirs = flags & SEND_BUILD_DIRS; 5620 args.force = flags & SEND_FORCE; 5621 args.no_contents = flags & SEND_NO_CONTENTS; 5622 args.backup_modified = flags & BACKUP_MODIFIED_FILES; 5623 err = start_recursion 5624 (send_fileproc, send_filesdoneproc, 5625 send_dirent_proc, send_dirleave_proc, (void *) &args, | 3981 { 3982 error (1, 0, "gserver currently only enabled for socket connections"); 3983 } 3984 3985 if (! connect_to_gserver (root, fd, hostinfo)) 3986 { 3987 error (1, 0, 3988 "authorization failed: server %s rejected access to %s", --- 1642 unchanged lines hidden (view full) --- 5631 */ 5632 args.build_dirs = flags & SEND_BUILD_DIRS; 5633 args.force = flags & SEND_FORCE; 5634 args.no_contents = flags & SEND_NO_CONTENTS; 5635 args.backup_modified = flags & BACKUP_MODIFIED_FILES; 5636 err = start_recursion 5637 (send_fileproc, send_filesdoneproc, 5638 send_dirent_proc, send_dirleave_proc, (void *) &args, |
5626 argc, argv, local, W_LOCAL, aflag, 0, (char *)NULL, 0); | 5639 argc, argv, local, W_LOCAL, aflag, LOCK_NONE, (char *)NULL, 0); |
5627 if (err) 5628 error_exit (); 5629 if (toplevel_repos == NULL) 5630 /* 5631 * This happens if we are not processing any files, 5632 * or for checkouts in directories without any existing stuff 5633 * checked out. The following assignment is correct for the 5634 * latter case; I don't think toplevel_repos matters for the --- 308 unchanged lines hidden --- | 5640 if (err) 5641 error_exit (); 5642 if (toplevel_repos == NULL) 5643 /* 5644 * This happens if we are not processing any files, 5645 * or for checkouts in directories without any existing stuff 5646 * checked out. The following assignment is correct for the 5647 * latter case; I don't think toplevel_repos matters for the --- 308 unchanged lines hidden --- |