aboutsummaryrefslogtreecommitdiffstats
path: root/net/openldap22-server
ModeNameSize
-rw-r--r--Makefile1715logstatsplainblame
-rw-r--r--distinfo60logstatsplainblame
d---------files36logstatsplain
-rw-r--r--pkg-comment44logstatsplainblame
-rw-r--r--pkg-descr473logstatsplainblame
-rw-r--r--pkg-plist879logstatsplainblame
> 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




























































































































































































































































































































































































































































































































































































































































































































                                                                                                                     
/*-------------------------------------------------------*/
/* innbbs.c ( NTHU CS MapleBBS Ver 3.10 )        */
/*-------------------------------------------------------*/
/* target : 轉信設定                     */
/* create : 04/04/25                     */
/* update :   /  /                       */
/* author : itoc.bbs@bbs.tnfsh.tn.edu.tw         */
/*-------------------------------------------------------*/


#include "bbs.h"


extern BCACHE *bshm;


/* ----------------------------------------------------- */
/* nodelist.bbs 子函式                    */
/* ----------------------------------------------------- */


static void
nl_item(num, nl)
  int num;
  nodelist_t *nl;
{
  prints("%6d %-13s%-*.*s %s(%d)\n", num, 
    nl->name, d_cols + 45, d_cols + 45, nl->host, nl->xmode & INN_USEIHAVE ? "IHAVE" : "POST", nl->port);
}


static void
nl_query(nl)
  nodelist_t *nl;
{
  move(3, 0);
  clrtobot();
  prints("\n\n轉信站台:%s\n站台位址:%s\n站台協定:%s(%d)\n被 餵 信:%s", 
    nl->name, nl->host, nl->xmode & INN_USEIHAVE ? "IHAVE" : "POST", nl->port, nl->xmode & INN_FEEDED ? "是" : "否");
  vmsg(NULL);
}


static int  /* 1:成功 0:失敗 */
nl_add(fpath, old, pos)
  char *fpath;
  nodelist_t *old;
  int pos;
{
  nodelist_t nl;
  int ch, port;
  char ans[8];
  char msg1[] = "協定:(1)IHAVE (2)POST [1] ";
  char msg2[] = "此站台會主動餵信給本站嗎(Y/N)?[N] ";

  if (old)
    memcpy(&nl, old, sizeof(nodelist_t));
  else
    memset(&nl, 0, sizeof(nodelist_t));

  if (vget(b_lines, 0, "英文站名:", nl.name, sizeof(nl.name), GCARRY) &&
    vget(b_lines, 0, "站址:", nl.host, /* sizeof(nl.host) */ 70, GCARRY))
  {
    msg1[24] = (nl.xmode & INN_USEPOST) ? '2' : '1';    /* 新增資料預設 INN_HAVE */
    ch = vans(msg1);
    if (ch != '1' && ch != '2')
      ch = msg1[24];

    if (ch == '1')
    {
      nl.xmode = INN_USEIHAVE | INN_FEEDED; /* IHAVE 一定是被餵信 */
      vget(b_lines, 0, "Port:[7777] ", ans, 6, DOECHO);
      if ((port = atoi(ans)) <= 0)
    port = 7777;
    }
    else /* if (ch == '2') */
    {
      nl.xmode = INN_USEPOST;
      vget(b_lines, 0, "Port:[119] ", ans, 6, DOECHO);
      if ((port = atoi(ans)) <= 0)
    port = 119;

      msg2[32] = (old && old->xmode & INN_FEEDED) ? 'Y' : 'N';  /* 新增資料預設不餵信 */
      ch = vans(msg2);
      if (ch != 'y' && ch != 'n')
    ch = msg2[32] | 0x20;

      if (ch == 'y')
    nl.xmode |= INN_FEEDED;
    }
    nl.port = port;

    if (old)
      rec_put(fpath, &nl, sizeof(nodelist_t), pos, NULL);
    else
      rec_add(fpath, &nl, sizeof(nodelist_t));
    return 1;
  }
  return 0;
}


static int
nl_cmp(a, b)
  nodelist_t *a, *b;
{
  /* 依 name 排序 */
  return str_cmp(a->name, b->name);
}


static int
nl_search(nl, key)
  nodelist_t *nl;
  char *key;
{
  return (int) (str_str(nl->name, key) || str_str(nl->host, key));
}


/* ----------------------------------------------------- */
/* newsfeeds.bbs 子函式                   */
/* ----------------------------------------------------- */


static void
nf_item(num, nf)
  int num;
  newsfeeds_t *nf;
{
  int bno;
  BRD *brd;
  char outgo, income;

  if ((bno = brd_bno(nf->board)) >= 0)
  {
    if (nf->xmode & INN_ERROR)
    {
      outgo = income = '?';
    }
    else
    {
      brd = bshm->bcache + bno;
      outgo = brd->battr & BRD_NOTRAN ? ' ' : '<';
      income = nf->xmode & INN_NOINCOME ? ' ': '>';
    }
  }
  else
  {
    outgo = income = 'X';
  }

  prints("%6d %-13s%-*.*s %c-%c %-13s %.7s\n", num, 
    nf->path, d_cols + 32, d_cols + 32, nf->newsgroup, outgo, income, nf->board, nf->charset);
}


static void
nf_query(nf)
  newsfeeds_t *nf;
{
  nodelist_t nl;
  int fd;
  int rc = 0;
  BRD *brd;
  char *outgo, *income;

  /* 找出該站台在 nodelist.bbs 中的資訊 */
  if ((fd = open("innd/nodelist.bbs", O_RDONLY)) >= 0)
  {
    while (read(fd, &nl, sizeof(nodelist_t)) == sizeof(nodelist_t))
    {
      if (!strcmp(nl.name, nf->path))
      {
    rc = 1;
    break;
      }
    }
    close(fd);
  }
  if (!rc)
  {
    memset(&nl, 0, sizeof(nodelist_t));
    strcpy(nl.host, "\033[1;33m此站台不在 nodelist.bbs 中\033[m");
  }

  /* 看板狀態 */
  if ((rc = brd_bno(nf->board)) >= 0)
  {
    brd = bshm->bcache + rc;
    outgo = brd->battr & BRD_NOTRAN ? "\033[1;33m不轉出\033[m"  : "轉出";
    income = nf->xmode & INN_NOINCOME ? "且\033[1;33m不轉進\033[m" : "且轉進";
  }
  else
  {
    outgo = "\033[1;33m此看板不存在\033[m";
    income = "";
  }

  move(3, 0);
  clrtobot();
  prints("\n\n轉信站台:%s\n站台位址:%s\n站台協定:%s(%d)\n"
    "轉信群組:%s%s\n本站看板:%s (%s%s)\n使用字集:%s", 
    nf->path, nl.host, nl.xmode & INN_USEIHAVE ? "IHAVE" : "POST", nl.port, 
    nf->newsgroup, nf->xmode & INN_ERROR ? " (\033[1;33m此群組不存在\033[m)" : "", 
    nf->board, outgo, income, nf->charset);
  if (rc && !(nl.xmode & INN_FEEDED))
    prints("\n目前篇數:%d", nf->high);
  vmsg(NULL);
}


static int  /* 1:成功 0:失敗 */
nf_add(fpath, old, pos)
  char *fpath;
  newsfeeds_t *old;
  int pos;
{
  newsfeeds_t nf;
  int high;
  char ans[12];
  BRD *brd;

  if (old)
    memcpy(&nf, old, sizeof(newsfeeds_t));
  else
  {
    memset(&nf, 0, sizeof(newsfeeds_t));
    nf.high = INT_MAX;      /* 第一次取信強迫 reload */
  }

  if ((brd = ask_board(nf.board, BRD_L_BIT, NULL)) &&
    vget(b_lines, 0, "英文站名:", nf.path, sizeof(nf.path), GCARRY) &&
    vget(b_lines, 0, "群組:", nf.newsgroup, /* sizeof(nf.newsgroup) */ 70, GCARRY))
  {
    if (!vget(b_lines, 0, "字集 [" MYCHARSET "]:", nf.charset, sizeof(nf.charset), GCARRY))
      str_ncpy(nf.charset, MYCHARSET, sizeof(nf.charset));
    nf.xmode = (vans("是否轉進(Y/N)?[Y] ") == 'n') ? INN_NOINCOME : 0;

    if (vans("是否更改轉信的 high-number 設定,這設定對被餵信的群組無效(Y/N)?[N] ") == 'y')
    {
      sprintf(ans, "%d", nf.high);
      vget(b_lines, 0, "目前篇數:", ans, 11, GCARRY);
      if ((high = atoi(ans)) >= 0)
    nf.high = high;
    }

    if (old)
      rec_put(fpath, &nf, sizeof(newsfeeds_t), pos, NULL);
    else
      rec_add(fpath, &nf, sizeof(newsfeeds_t));

    if ((brd->battr & BRD_NOTRAN) && vans("本板屬性目前為不轉出,是否改為轉出(Y/N)?[Y] ") != 'n')
    {
      high = brd - bshm->bcache;
      brd->battr &= ~BRD_NOTRAN;
      rec_put(FN_BRD, brd, sizeof(BRD), high, NULL);
    }

    return 1;
  }
  return 0;
}


static int
nf_cmp(a, b)
  newsfeeds_t *a, *b;
{
  /* path/newsgroup 交叉比對 */
  int k = str_cmp(a->path, b->path);
  return k ? k : str_cmp(a->newsgroup, b->newsgroup);
}


static int
nf_search(nf, key)
  newsfeeds_t *nf;
  char *key;
{
  return (int) (str_str(nf->newsgroup, key) || str_str(nf->board, key));
}


/* ----------------------------------------------------- */
/* ncmperm.bbs 子函式                     */
/* ----------------------------------------------------- */


static void
ncm_item(num, ncm)
  int num;
  ncmperm_t *ncm;
{
  prints("%6d %-*.*s%-23.23s %s\n", num, 
    d_cols + 44, d_cols + 44, ncm->issuer, ncm->type, ncm->perm ? "○" : "╳");
}


static void
ncm_query(ncm)
  ncmperm_t *ncm;
{
  move(3, 0);
  clrtobot();
  prints("\n\n發行站台:%s\n砍信種類:%s\n允許\砍信:%s", 
    ncm->issuer, ncm->type, ncm->perm ? "○" : "╳");
  vmsg(NULL);
}


static int  /* 1:成功 0:失敗 */
ncm_add(fpath, old, pos)
  char *fpath;
  ncmperm_t *old;
  int pos; 
{
  ncmperm_t ncm;

  if (old)
    memcpy(&ncm, old, sizeof(ncmperm_t));
  else
    memset(&ncm, 0, sizeof(ncmperm_t));

  if (vget(b_lines, 0, "發行:", ncm.issuer, /* sizeof(ncm.issuer) */ 70, GCARRY) &&
    vget(b_lines, 0, "種類:", ncm.type, sizeof(ncm.type), GCARRY))
  {
    ncm.perm = (vans("允許\此 NCM message 砍信(Y/N)?[N] ") == 'y');

    if (old)
      rec_put(fpath, &ncm, sizeof(ncmperm_t), pos, NULL);
    else
      rec_add(fpath, &ncm, sizeof(ncmperm_t));
    return 1;
  }
  return 0;
}


static int
ncm_cmp(a, b)
  ncmperm_t *a, *b;
{
  /* issuer/type 交叉比對 */
  int k = str_cmp(a->issuer, b->issuer);
  return k ? k : str_cmp(a->type, b->type);
}


static int
ncm_search(ncm, key)
  ncmperm_t *ncm;
  char *key;
{
  return (int) (str_str(ncm->issuer, key) || str_str(ncm->type, key));
}


/* ----------------------------------------------------- */
/* spamrule.bbs 子函式                    */
/* ----------------------------------------------------- */


static char *
spam_compare(xmode)
  int xmode;
{
  if (xmode & INN_SPAMADDR)
    return "作者";
  if (xmode & INN_SPAMNICK)
    return "暱稱";
  if (xmode & INN_SPAMSUBJECT)
    return "標題";
  if (xmode & INN_SPAMPATH)
    return "路徑";
  if (xmode & INN_SPAMMSGID)
    return "MSID";
  if (xmode & INN_SPAMBODY)
    return "本文";
  if (xmode & INN_SPAMSITE)
    return "組織";
  if (xmode & INN_SPAMPOSTHOST)
    return "來源";
  return "??";
}


static void
spam_item(num, spam)
  int num;
  spamrule_t *spam;
{
  char *path, *board;

  path = spam->path;
  board = spam->board;
  prints("%6d %-13s%-13s[%s] 包含 %.*s\n", 
    num, *path ? path : "所有站台", *board ? board : "所有看板", 
    spam_compare(spam->xmode), d_cols + 30, spam->detail);
}


static void
spam_query(spam)
  spamrule_t *spam;
{
  char *path, *board;

  path = spam->path;
  board = spam->board;

  move(3, 0);
  clrtobot();
  prints("\n\n適用站台:%s\n適用看板:%s\n比較項目:%s\n比較內容:%s", 
    *path ? path : "所有站台", *board ? board : "所有看板", spam_compare(spam->xmode), spam->detail);
  vmsg("若滿足此規則,會被視為廣告而無法轉信進來");
}


static int  /* 1:成功 0:失敗 */
spam_add(fpath, old, pos)
  char *fpath;
  spamrule_t *old;
  int pos; 
{
  spamrule_t spam;

  if (old)
    memcpy(&spam, old, sizeof(spamrule_t));
  else
    memset(&spam, 0, sizeof(spamrule_t));

  vget(b_lines, 0, "英文站名:", spam.path, sizeof(spam.path), GCARRY);
  ask_board(spam.board, BRD_L_BIT, NULL);

  switch (vans("擋信規則 1)作者 2)暱稱 3)標題 4)路徑 5)MSGID 6)本文 7)組織 8)來源 [Q] "))
  {
  case '1':
    spam.xmode = INN_SPAMADDR;
    break;
  case '2':
    spam.xmode = INN_SPAMNICK;
    break;
  case '3':
    spam.xmode = INN_SPAMSUBJECT;
    break;
  case '4':
    spam.xmode = INN_SPAMPATH;
    break;
  case '5':
    spam.xmode = INN_SPAMMSGID;
    break;
  case '6':