00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #define FileVerbose if (VERBOSE || DEBUG || D2) fprintf
00039
00040 #include "cf.defs.h"
00041 #include "cf.extern.h"
00042
00043 enum fileoutputlevels
00044 {
00045 fopl_normal,
00046 fopl_error,
00047 fopl_inform
00048 };
00049
00050 int MAXCHILD = 1;
00051 int FileFlag = 0;
00052 int TRUSTALL = false;
00053 enum fileoutputlevels OUTPUTLEVEL = fopl_normal;
00054 char OUTPUTDIR[bufsize];
00055
00056 struct Item *VCFRUNCLASSES = NULL;
00057 struct Item *VCFRUNOPTIONHOSTS = NULL;
00058 struct Item *VCFRUNHOSTLIST = NULL;
00059
00060 char VCFRUNHOSTS[bufsize] = "cfrun.hosts";
00061 char CFRUNOPTIONS[bufsize];
00062 char CFLOCK[bufsize] = "dummy";
00063
00064
00065
00066
00067
00068 void CheckOptsAndInit ARGLIST((int argc,char **argv));
00069 int PollServer ARGLIST((char *host, char *options, int StoreInFile));
00070 void SendClassData ARGLIST((int sd, char *sendbuffer));
00071 void CheckAccess ARGLIST((char *users));
00072 void cfrunSyntax ARGLIST((void));
00073 void ReadCfrunConf ARGLIST((void));
00074 int ParseHostname ARGLIST((char *hostname, char *new_hostname));
00075 void FileOutput ARGLIST((FILE *fp, enum fileoutputlevels level, char *message));
00076
00077
00078
00079
00080
00081 int main (argc,argv)
00082
00083 int argc;
00084 char **argv;
00085
00086 { struct Item *ip;
00087 int i=0;
00088 int status;
00089 int pid;
00090
00091 CheckOptsAndInit(argc,argv);
00092
00093 ip = VCFRUNHOSTLIST;
00094
00095 while (ip != NULL)
00096 {
00097 if (i < MAXCHILD)
00098 {
00099 if (fork() == 0)
00100 {
00101 printf("cfrun(%d): .......... [ Hailing %s ] ..........\n",i,ip->name);
00102 Debug("pid = %d i = %d\n", getpid(), i);
00103
00104 if (PollServer(ip->name,ip->classes, FileFlag))
00105 {
00106 Verbose("Connection with %s completed\n\n",ip->name);
00107 }
00108 else
00109 {
00110 Verbose("Connection refused...\n\n");
00111 }
00112 exit(0);
00113 }
00114 else
00115 {
00116
00117 i++;
00118 }
00119 }
00120 else
00121 {
00122 pid = wait(&status);
00123 Debug("wait result pid = %d number %d\n", pid, i);
00124 i--;
00125 }
00126 if ( i < MAXCHILD )
00127 {
00128 ip = ip->next;
00129 }
00130 }
00131
00132 while (i > 0)
00133 {
00134 pid = wait(&status);
00135 Debug("Child pid = %d ended\n", pid);
00136 i--;
00137 }
00138
00139 exit(0);
00140 return 0;
00141 }
00142
00143
00144
00145
00146
00147 void CheckOptsAndInit(argc,argv)
00148
00149 int argc;
00150 char **argv;
00151
00152 { int optgroup = 0, i;
00153 struct Item *ip;
00154
00155
00156 bzero(CFRUNOPTIONS,bufsize);
00157
00158 for (i = 1; i < argc; i++)
00159 {
00160 if (optgroup == 0)
00161 {
00162 if (strncmp(argv[i],"-h",2) == 0)
00163 {
00164 cfrunSyntax();
00165 }
00166 else if (strncmp(argv[i],"-f",2) == 0)
00167 {
00168 i++;
00169
00170 if ((i >= argc) || (strncmp(argv[i],"-",1) == 0))
00171 {
00172 printf("Error: No filename listed after -f option.\n");
00173 cfrunSyntax();
00174 exit(0);
00175 }
00176 bzero(VCFRUNHOSTS,bufsize);
00177 strcat(VCFRUNHOSTS,argv[i]);
00178 Debug("cfrun: cfrun file = %s\n",VCFRUNHOSTS);
00179 }
00180 else if (strncmp(argv[i],"-d",2) == 0)
00181 {
00182 DEBUG = true;
00183 VERBOSE = true;
00184 }
00185 else if (strncmp(argv[i],"-v",2) == 0)
00186 {
00187 VERBOSE=true;
00188 }
00189 else if (strncmp(argv[i],"-T",2) == 0)
00190 {
00191 TRUSTALL = true;
00192 }
00193 else if (strncmp(argv[i],"-S",2) == 0)
00194 {
00195 SILENT = true;
00196 }
00197 else if (strncmp(argv[i],"--",2) == 0)
00198 {
00199 optgroup++;
00200 }
00201 else if (argv[i][0] == '-')
00202 {
00203 printf("Error: Unknown option.\n");
00204 cfrunSyntax();
00205 exit(0);
00206 }
00207 else
00208 {
00209 AppendItem(&VCFRUNOPTIONHOSTS,argv[i],NULL);
00210 }
00211 }
00212 else if (optgroup == 1)
00213 {
00214 if (strncmp(argv[i],"--",2) == 0)
00215 {
00216 optgroup++;
00217 }
00218 else
00219 {
00220 strcat(CFRUNOPTIONS,argv[i]);
00221 strcat(CFRUNOPTIONS," ");
00222 }
00223 }
00224 else
00225 {
00226 AppendItem(&VCFRUNCLASSES,argv[i],"");
00227 }
00228 }
00229
00230 Debug("CFRUNOPTIONS string: %s\n",CFRUNOPTIONS);
00231
00232 for (ip = VCFRUNCLASSES; ip != NULL; ip=ip->next)
00233 {
00234 Debug("Class item: %s\n",ip->name);
00235 }
00236
00237 ReadCfrunConf();
00238
00239 GetNameInfo();
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259 Debug("FQNAME = %s\n",VFQNAME);
00260
00261 sprintf(VPREFIX,"cfrun:%s",VFQNAME);
00262
00263
00264
00265 umask(077);
00266 strcpy(VLOCKDIR,WORKDIR);
00267 strcpy(VLOGDIR,WORKDIR);
00268
00269 OpenSSL_add_all_algorithms();
00270 ERR_load_crypto_strings();
00271 CheckWorkDirectories();
00272 LoadSecretKeys();
00273 RandomSeed();
00274
00275 }
00276
00277
00278
00279
00280 int PollServer(host,options,StoreInFile)
00281
00282 char *host, *options;
00283 int StoreInFile;
00284
00285 { struct hostent *hp;
00286 struct sockaddr_in raddr;
00287 char sendbuffer[bufsize],recvbuffer[bufsize];
00288 char filebuffer[bufsize],parsed_host[bufsize];
00289 char reply[8];
00290 struct servent *server;
00291 int err,n_read,first,port;
00292 char *sp,forceipv4='n';
00293 FILE *fp;
00294 struct Image addresses;
00295 #ifdef HAVE_GETADDRINFO
00296 struct addrinfo query, *response=NULL, *ap;
00297 #endif
00298
00299 CONN = NewAgentConn();
00300
00301 if (StoreInFile)
00302 {
00303 sprintf(filebuffer, "%s/%s", OUTPUTDIR, host);
00304 if ((fp = fopen(filebuffer, "w")) == NULL)
00305 {
00306 return false;
00307 }
00308 }
00309 else
00310 {
00311 fp = stdout;
00312 }
00313
00314 port = ParseHostname(host,parsed_host);
00315
00316 FileVerbose(fp, "Connecting to server %s to port %d with options %s %s\n",parsed_host,port,options,CFRUNOPTIONS);
00317
00318 #ifdef HAVE_GETADDRINFO
00319
00320 Debug("Using v6 compatible lookup...\n");
00321
00322 bzero(&query,sizeof(struct addrinfo));
00323 query.ai_family = AF_UNSPEC;
00324 query.ai_socktype = SOCK_STREAM;
00325 query.ai_flags = AI_PASSIVE;
00326
00327 if ((err=getaddrinfo(parsed_host,NULL,&query,&response)) != 0)
00328 {
00329 snprintf(OUTPUT,bufsize,"Unable to lookup %s (%s)",parsed_host,gai_strerror(err));
00330 CfLog(cferror,OUTPUT,"");
00331 }
00332
00333 for (ap = response; ap != NULL; ap = ap->ai_next)
00334 {
00335 snprintf(CONN->remoteip,cfmaxiplen,"%s",sockaddr_ntop(ap->ai_addr));
00336 break;
00337 }
00338
00339 if (response != NULL)
00340 {
00341 freeaddrinfo(response);
00342 }
00343
00344 #else
00345
00346 if ((hp = gethostbyname(parsed_host)) == NULL)
00347 {
00348 printf("Unknown host: %s\n", parsed_host);
00349 printf("Make sure that fully qualified names can be looked up at your site!\n");
00350 printf("i.e. www.gnu.org, not just www. If you use NIS or /etc/hosts\n");
00351 printf("make sure that the full form is registered too as an alias!\n");
00352 FileOutput(fp, fopl_error, "Unknown host\n");
00353 exit(1);
00354 }
00355
00356 bzero(&raddr,sizeof(raddr));
00357
00358 if (port)
00359 {
00360 raddr.sin_port = htons(port);
00361 }
00362 else
00363 {
00364 if ((server = getservbyname(CFENGINE_SERVICE,"tcp")) == NULL)
00365 {
00366 CfLog(cferror,"Unable to find cfengine port","getservbyname");
00367 FileOutput(fp, fopl_error, "Unable to find cfengine port\n");
00368 exit (1);
00369 }
00370 else
00371 {
00372 raddr.sin_port = (unsigned int) server->s_port;
00373 }
00374 }
00375
00376 raddr.sin_addr.s_addr = ((struct in_addr *)(hp->h_addr))->s_addr;
00377 raddr.sin_family = AF_INET;
00378
00379 snprintf(CONN->remoteip,cfmaxiplen,"%s",inet_ntoa(raddr.sin_addr));
00380
00381 #endif
00382
00383 addresses.trustkey = 'n';
00384 addresses.encrypt = 'n';
00385 addresses.server = strdup(parsed_host);
00386
00387 snprintf(sendbuffer,bufsize,"root-%s",CONN->remoteip);
00388
00389
00390 if (HavePublicKey(sendbuffer) == NULL)
00391 {
00392 if (TRUSTALL)
00393 {
00394 printf("Accepting public key from %s\n",parsed_host);
00395 FileOutput(fp, fopl_inform, "Accepting public key from host\n");
00396 addresses.trustkey = 'y';
00397 }
00398 else
00399 {
00400 printf("WARNING - You do not have a public key from host %s = %s\n",host,CONN->remoteip);
00401 printf(" Do you want to accept one on trust? (yes/no)\n\n--> ");
00402
00403 while (true)
00404 {
00405 fgets(reply,8,stdin);
00406 Chop(reply);
00407
00408 if (strcmp(reply,"yes")==0)
00409 {
00410 addresses.trustkey = 'y';
00411 break;
00412 }
00413 else if (strcmp(reply,"no")==0)
00414 {
00415 break;
00416 }
00417 else
00418 {
00419 printf("Please reply yes or no...(%s)\n",reply);
00420 }
00421 }
00422 }
00423 }
00424
00425 if (!RemoteConnect(parsed_host,forceipv4))
00426 {
00427 CfLog(cferror,"Couldn't open a socket","socket");
00428 FileOutput(fp, fopl_error, "Couldn't open a socket\n");
00429 if (CONN->sd != cf_not_connected)
00430 {
00431 close(CONN->sd);
00432 CONN->sd = cf_not_connected;
00433 }
00434 free(addresses.server);
00435 return false;
00436 }
00437
00438 if (!IdentifyForVerification(CONN->sd,CONN->localip,CONN->family))
00439 {
00440 printf("Unable to open a channel\n");
00441 FileOutput(fp, fopl_error, "Unable to open a channel\n");
00442 close(CONN->sd);
00443 errno = EPERM;
00444 free(addresses.server);
00445 return false;
00446 }
00447
00448 if (!KeyAuthentication(&addresses))
00449 {
00450 snprintf(OUTPUT,bufsize,"Key-authentication for %s failed\n",VFQNAME);
00451 CfLog(cferror,OUTPUT,"");
00452 FileOutput(fp, fopl_error, "Key-authentication failed\n");
00453 errno = EPERM;
00454 close(CONN->sd);
00455 free(addresses.server);
00456 return false;
00457 }
00458
00459 snprintf(sendbuffer,bufsize,"EXEC %s %s",options,CFRUNOPTIONS);
00460
00461 if (SendTransaction(CONN->sd,sendbuffer,0,CF_DONE) == -1)
00462 {
00463 printf("Transmission rejected");
00464 FileOutput(fp, fopl_error, "Transmission rejected\n");
00465 close(CONN->sd);
00466 free(addresses.server);
00467 return false;
00468 }
00469
00470 SendClassData(CONN->sd,sendbuffer);
00471
00472 FileVerbose(fp, "%s replies..\n\n",parsed_host);
00473
00474 first = true;
00475
00476 while (true)
00477 {
00478 bzero(recvbuffer,bufsize);
00479
00480 if ((n_read = ReceiveTransaction(CONN->sd,recvbuffer,NULL)) == -1)
00481 {
00482 if (errno == EINTR)
00483 {
00484 continue;
00485 }
00486
00487 close(CONN->sd);
00488 free(addresses.server);
00489 return true;;
00490 }
00491
00492 if ((sp = strstr(recvbuffer,CFD_TERMINATOR)) != NULL)
00493 {
00494 *sp = '\0';
00495 fprintf(fp,"%s",recvbuffer);
00496 break;
00497 }
00498
00499 if ((sp = strstr(recvbuffer,"BAD:")) != NULL)
00500 {
00501 *sp = '\0';
00502 fprintf(fp,"%s",recvbuffer+4);
00503 }
00504
00505 if (n_read == 0)
00506 {
00507 if (!first)
00508 {
00509 fprintf(fp,"\n");
00510 }
00511 break;
00512 }
00513
00514 if (strlen(recvbuffer) == 0)
00515 {
00516 continue;
00517 }
00518
00519 if (strstr(recvbuffer,"too soon"))
00520 {
00521 FileVerbose(fp,"%s",recvbuffer);
00522 }
00523
00524 if (strstr(recvbuffer,"cfXen"))
00525 {
00526 fprintf(fp,"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n");
00527 continue;
00528 }
00529
00530 if (first)
00531 {
00532 fprintf(fp,"\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n");
00533 }
00534
00535 first = false;
00536
00537 fprintf(fp,"%s",recvbuffer);
00538 }
00539
00540 if (!first)
00541 {
00542 fprintf(fp,"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n");
00543 }
00544
00545 close(CONN->sd);
00546 free(addresses.server);
00547 return true;
00548 }
00549
00550
00551
00552
00553
00554
00555 void ReadCfrunConf()
00556
00557 { char filename[bufsize], *sp;
00558 char buffer[maxvarsize], options[bufsize], line[bufsize];
00559 FILE *fp;
00560 struct Item *ip;
00561
00562 bzero(filename,bufsize);
00563
00564 if (!strchr(VCFRUNHOSTS, '/'))
00565 {
00566 if ((sp=getenv(CFINPUTSVAR)) != NULL)
00567 {
00568 strcpy(filename,sp);
00569 if (filename[strlen(filename)-1] != '/')
00570 {
00571 strcat(filename,"/");
00572 }
00573 }
00574 else
00575 {
00576 snprintf(filename, bufsize, "%s/inputs/", WORKDIR);
00577 }
00578 }
00579
00580 strcat(filename,VCFRUNHOSTS);
00581
00582 if ((fp = fopen(filename,"r")) == NULL)
00583 {
00584 printf("Unable to open %s\n",filename);
00585 return;
00586 }
00587
00588 while (!feof(fp))
00589 {
00590 bzero(buffer,maxvarsize);
00591 bzero(options,bufsize);
00592 bzero(line,bufsize);
00593
00594 ReadLine(line,bufsize,fp);
00595
00596 if (strncmp(line,"domain",6) == 0)
00597 {
00598 sscanf(line,"domain = %295[^# \n]",VDOMAIN);
00599 Verbose("Domain name = %s\n",VDOMAIN);
00600 continue;
00601 }
00602
00603 if (strncmp(line,"maxchild", strlen("maxchild")) == 0)
00604 {
00605 sscanf(line,"maxchild = %295[^# \n]", buffer);
00606
00607 if ( (MAXCHILD = atoi(buffer)) == 0 )
00608 {
00609 MAXCHILD = 1;
00610 }
00611
00612 Verbose("cfrun: maxchild = %d\n", MAXCHILD);
00613 continue;
00614 }
00615
00616 if (strncmp(line,"outputdir", strlen("outputdir")) == 0)
00617 {
00618 sscanf(line,"outputdir = %295[^# \n]", OUTPUTDIR);
00619 Verbose("cfrun: outputdir = %s\n", OUTPUTDIR);
00620 if ( opendir(OUTPUTDIR) == NULL)
00621 {
00622 printf("Directory %s does not exists\n", OUTPUTDIR);
00623 exit(1);
00624 }
00625
00626 FileFlag=1;
00627 continue;
00628 }
00629
00630 if (strncmp(line,"outputlevel", strlen("outputlevel")) == 0)
00631 {
00632 sscanf(line,"outputlevel = %295[^# \n]", buffer);
00633
00634 if (strncmp(buffer,"inform", strlen("inform")) == 0)
00635 {
00636 OUTPUTLEVEL = fopl_inform;
00637 Verbose("cfrun: outputlevel = inform");
00638 }
00639 else if (strncmp(buffer,"error", strlen("error")) == 0)
00640 {
00641 OUTPUTLEVEL = fopl_error;
00642 Verbose("cfrun: outputlevel = error");
00643 }
00644 else if (strncmp(buffer,"normal", strlen("normal")) == 0)
00645 {
00646 OUTPUTLEVEL = fopl_normal;
00647 Verbose("cfrun: outputlevel = normal");
00648 }
00649 else
00650 {
00651 printf("Invalid outputlevel: %s\n", OUTPUTDIR);
00652 }
00653
00654 continue;
00655 }
00656
00657 if (strncmp(line,"access",6) == 0)
00658 {
00659 for (sp = line; (*sp != '=') && (*sp != '\0'); sp++)
00660 {
00661 }
00662
00663 if (*sp == '\0' || *(++sp) == '\0')
00664 {
00665 continue;
00666 }
00667
00668 CheckAccess(sp);
00669 continue;
00670 }
00671
00672 sscanf(line,"%295s %[^#\n]",buffer,options);
00673
00674 if (buffer[0] == '#')
00675 {
00676 continue;
00677 }
00678
00679 if (strlen(buffer) == 0)
00680 {
00681 continue;
00682 }
00683
00684
00685 if (VCFRUNOPTIONHOSTS != NULL && !IsItemIn(VCFRUNOPTIONHOSTS,buffer))
00686 {
00687 Verbose("Skipping host %s\n",buffer);
00688 continue;
00689 }
00690
00691 if ((!strstr(buffer,".")) && (strlen(VDOMAIN) > 0))
00692 {
00693 strcat(buffer,".");
00694 strcat(buffer,VDOMAIN);
00695 }
00696
00697 if (!IsItemIn(VCFRUNHOSTLIST,buffer))
00698 {
00699 AppendItem(&VCFRUNHOSTLIST,buffer,options);
00700 }
00701 }
00702
00703 for (ip = VCFRUNHOSTLIST; ip != NULL; ip=ip->next)
00704 {
00705 Debug("host item: %s (%s)\n",ip->name,ip->classes);
00706 }
00707
00708 fclose(fp);
00709
00710 }
00711
00712
00713
00714
00715 int ParseHostname(hostname,new_hostname)
00716
00717 char *hostname;
00718 char *new_hostname;
00719
00720 { int port=0;
00721
00722 sscanf(hostname,"%[^:]:%d", new_hostname, &port);
00723
00724 return(port);
00725 }
00726
00727
00728
00729
00730 void SendClassData(sd, sendbuffer)
00731
00732 int sd;
00733 char *sendbuffer;
00734
00735 { struct Item *ip;
00736 int used;
00737 char *sp;
00738
00739 sp = sendbuffer;
00740 used = 0;
00741 bzero(sendbuffer,bufsize);
00742
00743 for (ip = VCFRUNCLASSES; ip != NULL; ip = ip->next)
00744 {
00745 if (used + strlen(ip->name) +2 > bufsize)
00746 {
00747 if (SendTransaction(sd,sendbuffer,0,CF_DONE) == -1)
00748 {
00749 perror("send");
00750 return;
00751 }
00752
00753 used = 0;
00754 sp = sendbuffer;
00755 bzero(sendbuffer,bufsize);
00756 }
00757
00758 strcat(sendbuffer,ip->name);
00759 strcat(sendbuffer," ");
00760
00761 sp += strlen(ip->name)+1;
00762 used += strlen(ip->name)+1;
00763 }
00764
00765 if (used + strlen(CFD_TERMINATOR) +2 > bufsize)
00766 {
00767 if (SendTransaction(sd,sendbuffer,0,CF_DONE) == -1)
00768 {
00769 perror("send");
00770 return;
00771 }
00772
00773 used = 0;
00774 sp = sendbuffer;
00775 bzero(sendbuffer,bufsize);
00776 }
00777
00778 sprintf(sp,CFD_TERMINATOR);
00779
00780 if (SendTransaction(sd,sendbuffer,0,CF_DONE) == -1)
00781 {
00782 perror("send");
00783 return;
00784 }
00785 }
00786
00787
00788
00789 void CheckAccess(users)
00790
00791 char *users;
00792
00793 { char id[maxvarsize], *sp;
00794 struct passwd *pw;
00795 int uid,myuid;
00796
00797 myuid = getuid();
00798
00799 if (myuid == 0)
00800 {
00801 return;
00802 }
00803
00804 for (sp = users; *sp != '\0'; sp++)
00805 {
00806 id[0] = '\0';
00807
00808 sscanf(sp,"%295[^,:]",id);
00809
00810 sp += strlen(id);
00811
00812 if (isalpha((int)id[0]))
00813 {
00814 if ((pw = getpwnam(id)) == NULL)
00815 {
00816 printf("cfrun: No such user (%s) in password database\n",id);
00817 continue;
00818 }
00819
00820 if (pw->pw_uid == myuid)
00821 {
00822 return;
00823 }
00824 }
00825 else
00826 {
00827 uid = atoi(id);
00828 if (uid == myuid)
00829 {
00830 return;
00831 }
00832 }
00833 }
00834
00835 printf("cfrun: you have not been granted permission to run cfrun\n");
00836 exit(0);
00837 }
00838
00839
00840
00841 void FileOutput(fp, level, message)
00842
00843 FILE *fp;
00844 enum fileoutputlevels level;
00845 char *message;
00846
00847 {
00848 switch (level)
00849 {
00850 case fopl_inform:
00851 if (OUTPUTLEVEL >= fopl_inform)
00852 {
00853 fprintf(fp, "cfrun: INFORM: %s", message);
00854 }
00855 break;
00856 case fopl_error:
00857 if (OUTPUTLEVEL >= fopl_error)
00858 {
00859 fprintf(fp, "cfrun: ERROR: %s", message);
00860 }
00861 break;
00862
00863 }
00864 return;
00865 }
00866
00867
00868
00869 void cfrunSyntax()
00870
00871 {
00872 printf("Usage: cfrun [-f cfrun.hosts|-h|-d|-S|-T|-v] [-- OPTIONS [-- CLASSES]]\n\n");
00873 printf("-f cfrun.hosts\tcfrun file to read in list of hosts (see below for syntax.)\n");
00874 printf("-h\t\tGet this help message.\n");
00875 printf("-d\t\tDebug mode, turns on verbose as well.\n");
00876 printf("-S\t\tSilent mode.\n");
00877 printf("-T\t\tTrust all incoming public keys.\n");
00878 printf("-v\t\tVerbose mode.\n");
00879 printf("-- OPTIONS\tArguments to be passed to host application.\n");
00880 printf("-- CLASSES\tClasses to be defined for the hosts.\n\n");
00881 printf("e.g. cfrun -- -- linux Run on all linux machines\n");
00882 printf(" cfrun -- -p Ping and parse on all hosts\n");
00883 printf(" cfrun host1 host2 -- -p Ping and parse on named hosts\n");
00884 printf(" cfrun -v -- -p Ping all, local verbose\n");
00885 printf(" cfrun -v -- -k -- solaris Local verbose, all solaris, but no copy\n\n");
00886 printf("cfrun.hosts file syntax:\n");
00887 printf("# starts a comment\n");
00888 printf("domain = [domain]\t# Domain to use for connection(s).\n");
00889 printf("maxchild = [num]\t# Maximum number of children to spawn during run.\n");
00890 printf("outputdir = [dir]\t# Directory where to put host output files.\n");
00891 printf("access = [user]\t\t# User allowed to do cfrun?\n");
00892 printf("[host]\t\t\t# One host per line list to cycle through.\n");
00893 printf("\t\t\t# Only the hosts are required for cfrun to operate.\n");
00894
00895 exit(0);
00896 }
00897
00898
00899
00900 struct cfagent_connection *NewAgentConn()
00901
00902 { struct cfagent_connection *ap = (struct cfagent_connection *)malloc(sizeof(struct cfagent_connection));
00903
00904 ap->sd = cf_not_connected;
00905 ap->family = AF_INET;
00906 ap->trust = false;
00907 ap->localip[0] = '\0';
00908 ap->remoteip[0] = '\0';
00909 ap->session_key = NULL;
00910 return ap;
00911 };
00912
00913
00914
00915 void DeleteAgentConn(ap)
00916
00917 struct cfagent_connection *ap;
00918
00919 {
00920 if (ap->session_key != NULL)
00921 {
00922 free(ap->session_key);
00923 }
00924
00925 free(ap);
00926 ap = NULL;
00927 }
00928
00929
00930
00931
00932
00933 void FatalError(s)
00934
00935 char *s;
00936
00937 {
00938 exit(1);
00939 }
00940
00941
00942 int RecursiveTidySpecialArea(name,tp,maxrecurse,sb)
00943
00944 char *name;
00945 struct Tidy *tp;
00946 int maxrecurse;
00947 struct stat *sb;
00948 {
00949 return true;
00950 }
00951
00952 int CompareMD5Net(file1,file2,ip)
00953
00954 char *file1, *file2;
00955 struct Image *ip;
00956
00957 {
00958 return 0;
00959 }
00960
00961
00962 void yyerror(s)
00963
00964 char *s;
00965
00966 {
00967 }
00968
00969
00970