summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.string/isinstr.stp
blob: 4688fe18d39bbd806f9fa714f9c74e9d70f4e460 (plain)
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
probe begin
{
	a = "foo"
	str = "abcfoobad"

	if (isinstr(str,a))
		printf("\"%s\" is in \"%s\"\n", a, str)
	else
		printf("\"%s\" is NOT in \"%s\"\n", a, str)

	str = "abcdefg"
	if (isinstr(str,a))
		printf("\"%s\" is in \"%s\"\n", a, str)
	else
		printf("\"%s\" is NOT in \"%s\"\n", a, str)

	a = ""
	str = ""
	if (isinstr(str,a))
		printf("\"%s\" is in \"%s\"\n", a, str)
	else
		printf("\"%s\" is NOT in \"%s\"\n", a, str)

        exit()
}
33' href='#n33'>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 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>UNIX Permission Bits and Windows NT Access Control Lists</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="SAMBA Project Documentation"
HREF="samba-howto-collection.html"><LINK
REL="UP"
TITLE="Advanced Configuration"
HREF="optional.html"><LINK
REL="PREVIOUS"
TITLE="Advanced Configuration"
HREF="optional.html"><LINK
REL="NEXT"
TITLE="Configuring Group Mapping"
HREF="groupmapping.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SAMBA Project Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="optional.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="groupmapping.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="UNIX-PERMISSIONS"
></A
>Chapter 11. UNIX Permission Bits and Windows NT Access Control Lists</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
>11.1. <A
HREF="unix-permissions.html#AEN1533"
>Viewing and changing UNIX permissions using the NT 
	security dialogs</A
></DT
><DT
>11.2. <A
HREF="unix-permissions.html#AEN1539"
>How to view file security on a Samba share</A
></DT
><DT
>11.3. <A
HREF="unix-permissions.html#AEN1550"
>Viewing file ownership</A
></DT
><DT
>11.4. <A
HREF="unix-permissions.html#AEN1570"
>Viewing file or directory permissions</A
></DT
><DD
><DL
><DT
>11.4.1. <A
HREF="unix-permissions.html#AEN1585"
>File Permissions</A
></DT
><DT
>11.4.2. <A
HREF="unix-permissions.html#AEN1599"
>Directory Permissions</A
></DT
></DL
></DD
><DT
>11.5. <A
HREF="unix-permissions.html#AEN1606"
>Modifying file or directory permissions</A
></DT
><DT
>11.6. <A
HREF="unix-permissions.html#AEN1628"
>Interaction with the standard Samba create mask 
	parameters</A
></DT
><DT
>11.7. <A
HREF="unix-permissions.html#AEN1681"
>Interaction with the standard Samba file attribute 
	mapping</A
></DT
></DL
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN1533"
>11.1. Viewing and changing UNIX permissions using the NT 
	security dialogs</A
></H1
><P
>Windows NT clients can use their native security settings 
	dialog box to view and modify the underlying UNIX permissions.</P
><P
>Note that this ability is careful not to compromise 
	the security of the UNIX host Samba is running on, and 
	still obeys all the file permission rules that a Samba 
	administrator can set.</P
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="/usr/share/sgml/docbook/stylesheet/dsssl/modular/images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>	All access to Unix/Linux system file via Samba is controlled at
	the operating system file access control level. When trying to
	figure out file access problems it is vitally important to identify
	the identity of the Windows user as it is presented by Samba at
	the point of file access. This can best be determined from the
	Samba log files.
	</P
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN1539"
>11.2. How to view file security on a Samba share</A
></H1
><P
>From an NT4/2000/XP client, single-click with the right 
	mouse button on any file or directory in a Samba mounted 
	drive letter or UNC path. When the menu pops-up, click 
	on the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>Properties</I
></SPAN
> entry at the bottom of 
	the menu. This brings up the file properties dialog
	box. Click on the tab <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>Security</I
></SPAN
> and you 
	will see three buttons, <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>Permissions</I
></SPAN
>, 	
	<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>Auditing</I
></SPAN
>, and <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>Ownership</I
></SPAN
>. 
	The <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>Auditing</I
></SPAN
> button will cause either 
	an error message <SPAN
CLASS="ERRORNAME"
>A requested privilege is not held 
	by the client</SPAN
> to appear if the user is not the 
	NT Administrator, or a dialog which is intended to allow an 
	Administrator to add auditing requirements to a file if the 
	user is logged on as the NT Administrator. This dialog is 
	non-functional with a Samba share at this time, as the only 
	useful button, the <B
CLASS="COMMAND"
>Add</B
> button will not currently 
	allow a list of users to be seen.</P
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN1550"
>11.3. Viewing file ownership</A
></H1
><P
>Clicking on the <B
CLASS="COMMAND"
>"Ownership"</B
> button 
	brings up a dialog box telling you who owns the given file. The 
	owner name will be of the form :</P
><P
><B
CLASS="COMMAND"
>"SERVER\user (Long name)"</B
></P
><P
>Where <VAR
CLASS="REPLACEABLE"
>SERVER</VAR
> is the NetBIOS name of 
	the Samba server, <VAR
CLASS="REPLACEABLE"
>user</VAR
> is the user name of 
	the UNIX user who owns the file, and <VAR
CLASS="REPLACEABLE"
>(Long name)</VAR
>
	is the descriptive string identifying the user (normally found in the
	GECOS field of the UNIX password database). Click on the <B
CLASS="COMMAND"
>Close
	</B
> button to remove this dialog.</P
><P
>If the parameter <VAR
CLASS="PARAMETER"
>nt acl support</VAR
>
	is set to <CODE
CLASS="CONSTANT"
>false</CODE
> then the file owner will 
	be shown as the NT user <B
CLASS="COMMAND"
>"Everyone"</B
>.</P
><P
>The <B
CLASS="COMMAND"
>Take Ownership</B
> button will not allow 
	you to change the ownership of this file to yourself (clicking on 
	it will display a dialog box complaining that the user you are 
	currently logged onto the NT client cannot be found). The reason 
	for this is that changing the ownership of a file is a privileged 
	operation in UNIX, available only to the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>root</I
></SPAN
> 
	user. As clicking on this button causes NT to attempt to change 
	the ownership of a file to the current user logged into the NT 
	client this will not work with Samba at this time.</P
><P
>There is an NT chown command that will work with Samba 
	and allow a user with Administrator privilege connected 
	to a Samba server as root to change the ownership of 
	files on both a local NTFS filesystem or remote mounted NTFS 
	or Samba drive. This is available as part of the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>Seclib
	</I
></SPAN
> NT security library written by Jeremy Allison of 
	the Samba Team, available from the main Samba ftp site.</P
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN1570"
>11.4. Viewing file or directory permissions</A
></H1
><P
>The third button is the <B
CLASS="COMMAND"
>"Permissions"</B
> 
	button. Clicking on this brings up a dialog box that shows both 
	the permissions and the UNIX owner of the file or directory. 
	The owner is displayed in the form :</P
><P
><B
CLASS="COMMAND"
>"SERVER\user (Long name)"</B
></P
><P
>Where <VAR
CLASS="REPLACEABLE"
>SERVER</VAR
> is the NetBIOS name of 
	the Samba server, <VAR
CLASS="REPLACEABLE"
>user</VAR
> is the user name of 
	the UNIX user who owns the file, and <VAR
CLASS="REPLACEABLE"
>(Long name)</VAR
>
	is the descriptive string identifying the user (normally found in the
	GECOS field of the UNIX password database).</P
><P
>If the parameter <VAR
CLASS="PARAMETER"
>nt acl support</VAR
>
	is set to <CODE
CLASS="CONSTANT"
>false</CODE
> then the file owner will 
	be shown as the NT user <B
CLASS="COMMAND"
>"Everyone"</B
> and the 
	permissions will be shown as NT "Full Control".</P
><P
>The permissions field is displayed differently for files 
	and directories, so I'll describe the way file permissions 
	are displayed first.</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1585"
>11.4.1. File Permissions</A
></H2
><P
>The standard UNIX user/group/world triple and 
		the corresponding "read", "write", "execute" permissions 
		triples are mapped by Samba into a three element NT ACL 
		with the 'r', 'w', and 'x' bits mapped into the corresponding 
		NT permissions. The UNIX world permissions are mapped into 
		the global NT group <B
CLASS="COMMAND"
>Everyone</B
>, followed 
		by the list of permissions allowed for UNIX world. The UNIX 
		owner and group permissions are displayed as an NT 
		<B
CLASS="COMMAND"
>user</B
> icon and an NT <B
CLASS="COMMAND"
>local 
		group</B
> icon respectively followed by the list 
	 	of permissions allowed for the UNIX user and group.</P
><P
>As many UNIX permission sets don't map into common 
		NT names such as <B
CLASS="COMMAND"
>"read"</B
>, <B
CLASS="COMMAND"
>		"change"</B
> or <B
CLASS="COMMAND"
>"full control"</B
> then 
		usually the permissions will be prefixed by the words <B
CLASS="COMMAND"
>		"Special Access"</B
> in the NT display list.</P
><P
>But what happens if the file has no permissions allowed 
		for a particular UNIX user group or world component ? In order 
		to  allow "no permissions" to be seen and modified then Samba 
		overloads the NT <B
CLASS="COMMAND"
>"Take Ownership"</B
> ACL attribute 
		(which has no meaning in UNIX) and reports a component with 
		no permissions as having the NT <B
CLASS="COMMAND"
>"O"</B
> bit set. 
		This was chosen of course to make it look like a zero, meaning 
		zero permissions. More details on the decision behind this will 
		be given below.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1599"
>11.4.2. Directory Permissions</A
></H2
><P
>Directories on an NT NTFS file system have two 
		different sets of permissions. The first set of permissions 
		is the ACL set on the directory itself, this is usually displayed 
		in the first set of parentheses in the normal <B
CLASS="COMMAND"
>"RW"</B
> 
		NT style. This first set of permissions is created by Samba in 
		exactly the same way as normal file permissions are, described 
		above, and is displayed in the same way.</P
><P
>The second set of directory permissions has no real meaning 
		in the UNIX permissions world and represents the <B
CLASS="COMMAND"
>		"inherited"</B
> permissions that any file created within 
		this directory would inherit.</P
><P
>Samba synthesises these inherited permissions for NT by 
		returning as an NT ACL the UNIX permission mode that a new file 
		created by Samba on this share would receive.</P
></DIV
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN1606"
>11.5. Modifying file or directory permissions</A
></H1
><P
>Modifying file and directory permissions is as simple 
	as changing the displayed permissions in the dialog box, and 
	clicking the <B
CLASS="COMMAND"
>OK</B
> button. However, there are 
	limitations that a user needs to be aware of, and also interactions 
	with the standard Samba permission masks and mapping of DOS 
	attributes that need to also be taken into account.</P
><P
>If the parameter <VAR
CLASS="PARAMETER"
>nt acl support</VAR
>
	is set to <CODE
CLASS="CONSTANT"
>false</CODE
> then any attempt to set 
	security permissions will fail with an <B
CLASS="COMMAND"
>"Access Denied"
	</B
> message.</P
><P
>The first thing to note is that the <B
CLASS="COMMAND"
>"Add"</B
> 
	button will not return a list of users in Samba (it will give 
	an error message of <B
CLASS="COMMAND"