1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 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 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 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 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731
|
/*****************************************************************************
*
* COMMENTS.C - Comment functions for Nagios
*
* Copyright (c) 1999-2008 Ethan Galstad (egalstad@nagios.org)
* Copyright (c) 2009-2010 Icinga Development Team (http://www.icinga.org)
*
* License:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
#include "../include/config.h"
#include "../include/common.h"
#include "../include/comments.h"
#include "../include/objects.h"
/***** IMPLEMENTATION-SPECIFIC INCLUDES *****/
#ifdef USE_XCDDEFAULT
#include "../xdata/xcddefault.h"
#endif
#ifdef NSCORE
#include "../include/icinga.h"
#include "../include/broker.h"
#endif
#ifdef NSCGI
#include "../include/cgiutils.h"
#endif
comment *comment_list=NULL;
int defer_comment_sorting = 0;
static int unsorted_comments = 0;
comment **comment_hashlist=NULL;
#ifdef NSCORE
/******************************************************************/
/**************** INITIALIZATION/CLEANUP FUNCTIONS ****************/
/******************************************************************/
/* initializes comment data */
int initialize_comment_data(char *config_file){
int result=OK;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XCDDEFAULT
result=xcddefault_initialize_comment_data(config_file);
#endif
return result;
}
/* removes old/invalid comments */
int cleanup_comment_data(char *config_file){
int result=OK;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XCDDEFAULT
result=xcddefault_cleanup_comment_data(config_file);
#endif
return result;
}
/******************************************************************/
/****************** COMMENT OUTPUT FUNCTIONS **********************/
/******************************************************************/
/* adds a new host or service comment */
int add_new_comment(int type, int entry_type, char *host_name, char *svc_description, time_t entry_time, char *author_name, char *comment_data, int persistent, int source, int expires, time_t expire_time, unsigned long *comment_id){
int result=OK;
unsigned long new_comment_id=0L;
if(type==HOST_COMMENT)
result=add_new_host_comment(entry_type,host_name,entry_time,author_name,comment_data,persistent,source,expires,expire_time,&new_comment_id);
else
result=add_new_service_comment(entry_type,host_name,svc_description,entry_time,author_name,comment_data,persistent,source,expires,expire_time,&new_comment_id);
/* add an event to expire comment data if necessary... */
if(expires==TRUE)
schedule_new_event(EVENT_EXPIRE_COMMENT,FALSE,expire_time,FALSE,0,NULL,TRUE,(void *)new_comment_id,NULL,0);
/* save comment id */
if(comment_id!=NULL)
*comment_id=new_comment_id;
return result;
}
/* adds a new host comment */
int add_new_host_comment(int entry_type, char *host_name, time_t entry_time, char *author_name, char *comment_data, int persistent, int source, int expires, time_t expire_time, unsigned long *comment_id){
int result=OK;
unsigned long new_comment_id=0L;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XCDDEFAULT
result=xcddefault_add_new_host_comment(entry_type,host_name,entry_time,author_name,comment_data,persistent,source,expires,expire_time,&new_comment_id);
#endif
/* save comment id */
if(comment_id!=NULL)
*comment_id=new_comment_id;
#ifdef USE_EVENT_BROKER
/* send data to event broker */
broker_comment_data(NEBTYPE_COMMENT_ADD,NEBFLAG_NONE,NEBATTR_NONE,HOST_COMMENT,entry_type,host_name,NULL,entry_time,author_name,comment_data,persistent,source,expires,expire_time,new_comment_id,NULL);
#endif
return result;
}
/* adds a new service comment */
int add_new_service_comment(int entry_type, char *host_name, char *svc_description, time_t entry_time, char *author_name, char *comment_data, int persistent, int source, int expires, time_t expire_time, unsigned long *comment_id){
int result=OK;
unsigned long new_comment_id=0L;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XCDDEFAULT
result=xcddefault_add_new_service_comment(entry_type,host_name,svc_description,entry_time,author_name,comment_data,persistent,source,expires,expire_time,&new_comment_id);
#endif
/* save comment id */
if(comment_id!=NULL)
*comment_id=new_comment_id;
#ifdef USE_EVENT_BROKER
/* send data to event broker */
broker_comment_data(NEBTYPE_COMMENT_ADD,NEBFLAG_NONE,NEBATTR_NONE,SERVICE_COMMENT,entry_type,host_name,svc_description,entry_time,author_name,comment_data,persistent,source,expires,expire_time,new_comment_id,NULL);
#endif
return result;
}
/******************************************************************/
/***************** COMMENT DELETION FUNCTIONS *********************/
/******************************************************************/
/* deletes a host or service comment */
int delete_comment(int type, unsigned long comment_id){
int result=OK;
comment *this_comment=NULL;
comment *last_comment=NULL;
comment *next_comment=NULL;
int hashslot=0;
comment *this_hash=NULL;
comment *last_hash=NULL;
/* find the comment we should remove */
for(this_comment=comment_list,last_comment=comment_list;this_comment!=NULL;this_comment=next_comment){
next_comment=this_comment->next;
/* we found the comment we should delete */
if(this_comment->comment_id==comment_id && this_comment->comment_type==type)
break;
last_comment=this_comment;
}
/* remove the comment from the list in memory */
if(this_comment!=NULL){
#ifdef USE_EVENT_BROKER
/* send data to event broker */
broker_comment_data(NEBTYPE_COMMENT_DELETE,NEBFLAG_NONE,NEBATTR_NONE,type,this_comment->entry_type,this_comment->host_name,this_comment->service_description,this_comment->entry_time,this_comment->author,this_comment->comment_data,this_comment->persistent,this_comment->source,this_comment->expires,this_comment->expire_time,comment_id,NULL);
#endif
/* first remove from chained hash list */
hashslot=hashfunc(this_comment->host_name,NULL,COMMENT_HASHSLOTS);
last_hash=NULL;
for(this_hash=comment_hashlist[hashslot];this_hash;this_hash=this_hash->nexthash){
if(this_hash==this_comment){
if(last_hash){
last_hash->nexthash=this_hash->nexthash;
} else {
if (this_hash->nexthash){
comment_hashlist[hashslot]=this_hash->nexthash;
} else {
comment_hashlist[hashslot]=NULL;
}
}
break;
}
last_hash=this_hash;
}
/* then removed from linked list */
if(comment_list==this_comment)
comment_list=this_comment->next;
else
last_comment->next=next_comment;
/* free memory */
my_free(this_comment->host_name);
my_free(this_comment->service_description);
my_free(this_comment->author);
my_free(this_comment->comment_data);
my_free(this_comment);
result=OK;
}
else
result=ERROR;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XCDDEFAULT
if(type==HOST_COMMENT)
result=xcddefault_delete_host_comment(comment_id);
else
result=xcddefault_delete_service_comment(comment_id);
#endif
return result;
}
/* deletes a host comment */
int delete_host_comment(unsigned long comment_id){
int result=OK;
/* delete the comment from memory */
result=delete_comment(HOST_COMMENT,comment_id);
return result;
}
/* deletes a service comment */
int delete_service_comment(unsigned long comment_id){
int result=OK;
/* delete the comment from memory */
result=delete_comment(SERVICE_COMMENT,comment_id);
return result;
}
/* deletes all comments for a particular host or service */
int delete_all_comments(int type, char *host_name, char *svc_description){
int result=OK;
if(type==HOST_COMMENT)
result=delete_all_host_comments(host_name);
else
result=delete_all_service_comments(host_name,svc_description);
return result;
}
/* deletes all comments for a particular host */
int delete_all_host_comments(char *host_name){
int result=OK;
comment *temp_comment=NULL;
if(host_name==NULL)
return ERROR;
/* delete host comments from memory */
for(temp_comment=get_first_comment_by_host(host_name);temp_comment!=NULL;temp_comment=get_next_comment_by_host(host_name,temp_comment)){
if(temp_comment->comment_type==HOST_COMMENT)
delete_comment(HOST_COMMENT,temp_comment->comment_id);
}
return result;
}
/* deletes all non-persistent acknowledgement comments for a particular host */
int delete_host_acknowledgement_comments(host *hst){
int result=OK;
comment *temp_comment=NULL;
if(hst==NULL)
return ERROR;
/* delete comments from memory */
for(temp_comment=get_first_comment_by_host(hst->name);temp_comment!=NULL;temp_comment=get_next_comment_by_host(hst->name,temp_comment)){
if(temp_comment->comment_type==HOST_COMMENT && temp_comment->entry_type==ACKNOWLEDGEMENT_COMMENT && temp_comment->persistent==FALSE)
delete_comment(HOST_COMMENT,temp_comment->comment_id);
}
return result;
}
/* deletes all comments for a particular service */
int delete_all_service_comments(char *host_name, char *svc_description){
int result=OK;
comment *temp_comment=NULL;
comment *next_comment=NULL;
if(host_name==NULL || svc_description==NULL)
return ERROR;
/* delete service comments from memory */
for(temp_comment=comment_list;temp_comment!=NULL;temp_comment=next_comment){
next_comment=temp_comment->next;
if(temp_comment->comment_type==SERVICE_COMMENT && !strcmp(temp_comment->host_name,host_name) && !strcmp(temp_comment->service_description,svc_description))
delete_comment(SERVICE_COMMENT,temp_comment->comment_id);
}
return result;
}
/* deletes all non-persistent acknowledgement comments for a particular service */
int delete_service_acknowledgement_comments(service *svc){
int result=OK;
comment *temp_comment=NULL;
comment *next_comment=NULL;
if(svc==NULL)
return ERROR;
/* delete comments from memory */
for(temp_comment=comment_list;temp_comment!=NULL;temp_comment=next_comment){
next_comment=temp_comment->next;
if(temp_comment->comment_type==SERVICE_COMMENT && !strcmp(temp_comment->host_name,svc->host_name) && !strcmp(temp_comment->service_description,svc->description) && temp_comment->entry_type==ACKNOWLEDGEMENT_COMMENT && temp_comment->persistent==FALSE)
delete_comment(SERVICE_COMMENT,temp_comment->comment_id);
}
return result;
}
/* checks for an expired comment (and removes it) */
int check_for_expired_comment(unsigned long comment_id){
comment *temp_comment=NULL;
/* check all comments */
for(temp_comment=comment_list;temp_comment!=NULL;temp_comment=temp_comment->next){
/* delete the now expired comment */
if(temp_comment->comment_id==comment_id && temp_comment->expires==TRUE && temp_comment->expire_time<time(NULL)){
delete_comment(temp_comment->comment_type,comment_id);
break;
}
}
return OK;
}
#endif
/******************************************************************/
/****************** CHAINED HASH FUNCTIONS ************************/
/******************************************************************/
/* adds comment to hash list in memory */
int add_comment_to_hashlist(comment *new_comment){
comment *temp_comment=NULL;
comment *lastpointer=NULL;
int hashslot=0;
/* initialize hash list */
if(comment_hashlist==NULL){
int i;
comment_hashlist=(comment **)malloc(sizeof(comment *)*COMMENT_HASHSLOTS);
if(comment_hashlist==NULL)
return 0;
for(i=0;i<COMMENT_HASHSLOTS;i++)
comment_hashlist[i]=NULL;
}
if(!new_comment)
return 0;
hashslot=hashfunc(new_comment->host_name,NULL,COMMENT_HASHSLOTS);
lastpointer=NULL;
for(temp_comment=comment_hashlist[hashslot];temp_comment && compare_hashdata(temp_comment->host_name,NULL,new_comment->host_name,NULL)<0;temp_comment=temp_comment->nexthash){
if(compare_hashdata(temp_comment->host_name,NULL,new_comment->host_name,NULL)>=0)
break;
lastpointer=temp_comment;
}
/* multiples are allowed */
if(lastpointer)
lastpointer->nexthash=new_comment;
else
comment_hashlist[hashslot]=new_comment;
new_comment->nexthash=temp_comment;
return 1;
}
/******************************************************************/
/******************** ADDITION FUNCTIONS **************************/
/******************************************************************/
/* adds a host comment to the list in memory */
int add_host_comment(int entry_type, char *host_name, time_t entry_time, char *author, char *comment_data, unsigned long comment_id, int persistent, int expires, time_t expire_time, int source){
int result=OK;
result=add_comment(HOST_COMMENT,entry_type,host_name,NULL,entry_time,author,comment_data,comment_id,persistent,expires,expire_time,source);
return result;
}
/* adds a service comment to the list in memory */
int add_service_comment(int entry_type, char *host_name, char *svc_description, time_t entry_time, char *author, char *comment_data, unsigned long comment_id, int persistent, int expires, time_t expire_time, int source){
int result=OK;
result=add_comment(SERVICE_COMMENT,entry_type,host_name,svc_description,entry_time,author,comment_data,comment_id,persistent,expires,expire_time,source);
return result;
}
/* adds a comment to the list in memory */
int add_comment(int comment_type, int entry_type, char *host_name, char *svc_description, time_t entry_time, char *author, char *comment_data, unsigned long comment_id, int persistent, int expires, time_t expire_time, int source){
comment *new_comment=NULL;
comment *last_comment=NULL;
comment *temp_comment=NULL;
int result=OK;
/* make sure we have the data we need */
if(host_name==NULL || author==NULL || comment_data==NULL || (comment_type==SERVICE_COMMENT && svc_description==NULL))
return ERROR;
/* allocate memory for the comment */
if((new_comment=(comment *)calloc(1, sizeof(comment)))==NULL)
return ERROR;
/* duplicate vars */
if((new_comment->host_name=(char *)strdup(host_name))==NULL)
result=ERROR;
if(comment_type==SERVICE_COMMENT){
if((new_comment->service_description=(char *)strdup(svc_description))==NULL)
result=ERROR;
}
if((new_comment->author=(char *)strdup(author))==NULL)
result=ERROR;
if((new_comment->comment_data=(char *)strdup(comment_data))==NULL)
result=ERROR;
new_comment->comment_type=comment_type;
new_comment->entry_type=entry_type;
new_comment->source=source;
new_comment->entry_time=entry_time;
new_comment->comment_id=comment_id;
new_comment->persistent=(persistent==TRUE)?TRUE:FALSE;
new_comment->expires=(expires==TRUE)?TRUE:FALSE;
new_comment->expire_time=expire_time;
/* add comment to hash list */
if(result==OK){
if(!add_comment_to_hashlist(new_comment))
result=ERROR;
}
/* handle errors */
if(result==ERROR){
my_free(new_comment->comment_data);
my_free(new_comment->author);
my_free(new_comment->service_description);
my_free(new_comment->host_name);
my_free(new_comment);
return ERROR;
}
if(defer_comment_sorting){
new_comment->next=comment_list;
comment_list=new_comment;
unsorted_comments++;
}
else{
/* add new comment to comment list, sorted by comment id */
last_comment=comment_list;
for(temp_comment=comment_list;temp_comment!=NULL;temp_comment=temp_comment->next){
if(new_comment->comment_id<temp_comment->comment_id){
new_comment->next=temp_comment;
if(temp_comment==comment_list)
comment_list=new_comment;
else
last_comment->next=new_comment;
break;
}
else
last_comment=temp_comment;
}
if(comment_list==NULL){
new_comment->next=NULL;
comment_list=new_comment;
}
else if(temp_comment==NULL){
new_comment->next=NULL;
last_comment->next=new_comment;
}
}
#ifdef NSCORE
#ifdef USE_EVENT_BROKER
/* send data to event broker */
broker_comment_data(NEBTYPE_COMMENT_LOAD,NEBFLAG_NONE,NEBATTR_NONE,comment_type,entry_type,host_name,svc_description,entry_time,author,comment_data,persistent,source,expires,entry_time,comment_id,NULL);
#endif
#endif
return OK;
}
static int comment_compar(const void *p1, const void *p2){
comment *c1 = *(comment **)p1;
comment *c2 = *(comment **)p2;
return (c1->comment_id < c2->comment_id) ? -1 : (c1->comment_id - c2->comment_id);
}
int sort_comments(void){
comment **array, *last_comment;
int i = 0;
if(!defer_comment_sorting)
return OK;
defer_comment_sorting=0;
if(!unsorted_comments)
return OK;
if(!(array=malloc(sizeof(*array)*unsorted_comments)))
return ERROR;
while(comment_list && i<unsorted_comments){
array[i++]=comment_list;
comment_list=comment_list->next;
}
if (comment_list || i<unsorted_comments)
return ERROR;
qsort((void *)array, i, sizeof(*array), comment_compar);
comment_list = last_comment = array[0];
for (i=1; i<unsorted_comments;i++){
last_comment->next = array[i];
last_comment = last_comment->next;
}
last_comment->next = NULL;
my_free(array);
unsorted_comments = 0;
return OK;
}
/******************************************************************/
/********************* CLEANUP FUNCTIONS **************************/
/******************************************************************/
/* frees memory allocated for the comment data */
void free_comment_data(void){
comment *this_comment=NULL;
comment *next_comment=NULL;
/* free memory for the comment list */
for(this_comment=comment_list;this_comment!=NULL;this_comment=next_comment){
next_comment=this_comment->next;
my_free(this_comment->host_name);
my_free(this_comment->service_description);
my_free(this_comment->author);
my_free(this_comment->comment_data);
my_free(this_comment);
}
/* free hash list and reset list pointer */
my_free(comment_hashlist);
comment_hashlist=NULL;
comment_list=NULL;
return;
}
/******************************************************************/
/********************* UTILITY FUNCTIONS **************************/
/******************************************************************/
/* get the number of comments associated with a particular host */
int number_of_host_comments(char *host_name){
comment *temp_comment=NULL;
int total_comments=0;
if(host_name==NULL)
return 0;
for(temp_comment=get_first_comment_by_host(host_name);temp_comment!=NULL;temp_comment=get_next_comment_by_host(host_name,temp_comment)){
if(temp_comment->comment_type==HOST_COMMENT)
total_comments++;
}
return total_comments;
}
/* get the number of comments associated with a particular service */
int number_of_service_comments(char *host_name, char *svc_description){
comment *temp_comment=NULL;
int total_comments=0;
if(host_name==NULL || svc_description==NULL)
return 0;
for(temp_comment=get_first_comment_by_host(host_name);temp_comment!=NULL;temp_comment=get_next_comment_by_host(host_name,temp_comment)){
if(temp_comment->comment_type==SERVICE_COMMENT && !strcmp(temp_comment->service_description,svc_description))
total_comments++;
}
return total_comments;
}
/******************************************************************/
/********************* TRAVERSAL FUNCTIONS ************************/
/******************************************************************/
comment *get_first_comment_by_host(char *host_name){
return get_next_comment_by_host(host_name,NULL);
}
comment *get_next_comment_by_host(char *host_name, comment *start){
comment *temp_comment=NULL;
if(host_name==NULL || comment_hashlist==NULL)
return NULL;
if(start==NULL)
temp_comment=comment_hashlist[hashfunc(host_name,NULL,COMMENT_HASHSLOTS)];
else
temp_comment=start->nexthash;
for(;temp_comment && compare_hashdata(temp_comment->host_name,NULL,host_name,NULL)<0;temp_comment=temp_comment->nexthash);
if(temp_comment && compare_hashdata(temp_comment->host_name,NULL,host_name,NULL)==0)
return temp_comment;
return NULL;
}
/******************************************************************/
/********************** SEARCH FUNCTIONS **************************/
/******************************************************************/
/* find a service comment by id */
comment *find_service_comment(unsigned long comment_id){
return find_comment(comment_id,SERVICE_COMMENT);
}
/* find a host comment by id */
comment *find_host_comment(unsigned long comment_id){
return find_comment(comment_id,HOST_COMMENT);
}
/* find a comment by id */
comment *find_comment(unsigned long comment_id, int comment_type){
comment *temp_comment=NULL;
for(temp_comment=comment_list;temp_comment!=NULL;temp_comment=temp_comment->next){
if(comment_type!=ANY_COMMENT && temp_comment->comment_type!=comment_type)
continue;
if(temp_comment->comment_id==comment_id)
return temp_comment;
}
return NULL;
}
/* find a comment by comment_type, host_name, service_desc (NULL if hostcomment), entry_time, author, comment_data */
comment *find_comment_by_similar_content(int comment_type, char *hostname, char *service_description, char *author, char *comment_data){
comment *temp_comment=NULL;
for(temp_comment=comment_list;temp_comment!=NULL;temp_comment=temp_comment->next){
if(temp_comment->comment_type==comment_type
&& strcmp(temp_comment->host_name,hostname)==0
&& (service_description==NULL || strcmp(temp_comment->service_description,service_description)==0)
&& strcmp(temp_comment->author,author)==0
&& strcmp(temp_comment->comment_data,comment_data)==0)
return temp_comment;
}
return NULL;
}
|